IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26370


Ignore:
Timestamp:
Dec 8, 2009, 3:24:02 PM (16 years ago)
Author:
bills
Message:

fix bug in setting ccdnum in dvo Images table.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/src/ReadImageHeader.c

    r26284 r26370  
    55int ReadImageHeader (Header *header, Image *image, int photcode) {
    66
    7   int Nastro, ccdnum, hour, min, Nx, Ny, haveNx, haveNy, sourceID;
     7  int Nastro, hour, min, Nx, Ny, haveNx, haveNy, sourceID;
    88  double tmp, sec, Cerror, ZeroPt, FWHM_X, FWHM_Y;
    9   char *c, photname[64], line[80];
     9  char *c, photname[64], line[80], ccdnum[64];
    1010  PhotCode *photcodeData = NULL;
    1111
     
    174174  }
    175175
    176   if (!gfits_scan (header, CCDNumKeyword, "%d", 1, &ccdnum)) {
    177     image[0].ccdnum = 0xff;
    178   } else {
    179     image[0].ccdnum = ccdnum;
     176  if (!gfits_scan (header, CCDNumKeyword, "%s", 1, ccdnum)) {
     177    fprintf (stderr, "CCDNumKeyword %s not found\n", CCDNumKeyword);
     178    return FALSE;
     179  } else {
     180    // CCDNumKeyword (EXTNAME) is a string yet we need an integer
     181    // RULE: ccdnum is the value of the first string of digits in CCDNumKeyword
     182    // For example: ccdnum(XY42.hdr) = 42, ccdnum(XY01.hdr) = 1
     183    char *p = ccdnum;
     184    // get rid of any leading non-digit characters
     185    while (*p && !isdigit(*p)) p++;
     186    if (*p == 0) {
     187      fprintf (stderr, "invalid ccdnum %s\n", ccdnum);
     188      return FALSE;
     189    }
     190    image[0].ccdnum = atoi(p);
    180191  }
    181192
Note: See TracChangeset for help on using the changeset viewer.