IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10930


Ignore:
Timestamp:
Jan 5, 2007, 10:30:02 AM (19 years ago)
Author:
eugene
Message:

better handling of MEF input files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/imbox.c

    r7917 r10930  
    33int imbox (int argc, char **argv) {
    44 
    5   int i, j, status, InPic, flipped, Nextend;
     5  int i, j, Nskip, status, InPic, flipped, Nextend;
    66  Vector Xvec, Yvec;
    77  double r, d, x[4], y[4], Rmin, Rmax, Rmid;
    88  Header header;
    99  Coords coords;
     10  Coords mosaic;
    1011  Graphdata graphmode;
     12  FILE *f;
    1113
    1214  if (!style_args (&graphmode, &argc, argv, 0)) return FALSE;
     
    1820  SetGraph (graphmode);
    1921
    20   if (!gfits_read_header (argv[1], &header)) {
     22  f = fopen (argv[1], "r");
     23  if (f == NULL) {
    2124    gprint (GP_ERR, "file not found\n");
    2225    return (FALSE);
    23   }
    24  
    25   Nextend = 0;
    26   if (header.Naxes == 0) {
    27     gfits_scan (&header, "NEXTEND", "%d", 1, &Nextend);
    2826  }
    2927 
     
    3634  ALLOCATE (Yvec.elements, float, 8);
    3735
    38   for (i = Nextend ? 0 : -1; i < Nextend; i++) {
    39     if (Nextend) {
    40       gfits_read_Xheader (argv[1], &header, i);
    41     }
    42     if (!GetCoords (&coords, &header)) {
    43       gprint (GP_ERR, "can't get WCS info from header\n");
    44       return (TRUE);
     36  while (gfits_fread_header (f, &header)) {
     37    if (!GetCoords (&coords, &header)) goto skip;
     38    if (!strcmp (&coords.ctype[4], "-DIS")) {
     39      mosaic = coords;
     40      RegisterMosaic (&mosaic);
     41      goto skip;
    4542    }
    4643    x[0] = 0;               y[0] = 0;
     
    8481      PlotVector (8, Yvec.elements);
    8582    }
     83  skip:
     84    Nskip = gfits_matrix_size (&header);
     85    fseek (f, Nskip, SEEK_CUR);
     86    gfits_free_header (&header);
    8687  }
    87 
    88   gfits_free_header (&header);
     88  fclose (f);
    8989  free (Xvec.elements);
    9090  free (Yvec.elements);
Note: See TracChangeset for help on using the changeset viewer.