IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31626


Ignore:
Timestamp:
Jun 15, 2011, 5:15:24 AM (15 years ago)
Author:
eugene
Message:

CROTA2 is often used instead of CROTA1, check both

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110505/Ohana/src/libdvo/src/coordops.c

    r29001 r31626  
    440440int GetCoords (Coords *coords, Header *header) {
    441441 
    442   int status, itmp, Polynomial, Polyterm;
    443   double Lambda, rotate, scale;
     442  int status, status1, status2, itmp, Polynomial, Polyterm;
     443  double Lambda, rotate, rotate1, rotate2, scale;
    444444  double equinox;
    445445  char *ctype;
     
    456456  mode = COORD_TYPE_NONE;
    457457  {   
    458     int haveCTYPE, haveCDELT, haveCROTA, haveCDij, havePCij, haveRAo;
     458    int haveCTYPE, haveCDELT, haveCROTA, haveCROTA1, haveCROTA2, haveCDij, havePCij, haveRAo;
    459459    float tmp;
    460460    char stmp[80];
     
    463463    // set: (CDELTi + CROTAi), (CDELTi + PCij), (CDij),
    464464
    465     haveCTYPE = gfits_scan (header, "CTYPE2",   "%s", 1, stmp);
    466     haveCDELT = gfits_scan (header, "CDELT1",   "%f", 1, &tmp);
    467     haveCROTA = gfits_scan (header, "CROTA1",   "%f", 1, &tmp);
    468     haveCDij  = gfits_scan (header, "CD1_1",    "%f", 1, &tmp);
    469     havePCij  = gfits_scan (header, "PC001001", "%f", 1, &tmp);
    470     haveRAo   = gfits_scan (header, "RA_O",     "%f", 1, &tmp);
     465    haveCTYPE  = gfits_scan (header, "CTYPE2",   "%s", 1, stmp);
     466    haveCDELT  = gfits_scan (header, "CDELT1",   "%f", 1, &tmp);
     467    haveCROTA1 = gfits_scan (header, "CROTA1",   "%f", 1, &tmp);
     468    haveCROTA2 = gfits_scan (header, "CROTA2",   "%f", 1, &tmp);
     469    haveCDij   = gfits_scan (header, "CD1_1",    "%f", 1, &tmp);
     470    havePCij   = gfits_scan (header, "PC001001", "%f", 1, &tmp);
     471    haveRAo    = gfits_scan (header, "RA_O",     "%f", 1, &tmp);
    471472   
     473    haveCROTA = haveCROTA1 || haveCROTA2;
     474
    472475    if (haveCTYPE && havePCij  && haveCDELT) { mode = COORD_TYPE_PC;   goto gotit; }
    473476    if (haveCTYPE && haveCROTA && haveCDELT) { mode = COORD_TYPE_ROT;  goto gotit; }
     
    540543      status &= gfits_scan (header, "CDELT2", "%f", 1, &coords[0].cdelt2);
    541544
    542       status &= gfits_scan (header, "CROTA2", "%lf", 1, &rotate);
     545      status1 = gfits_scan (header, "CROTA1", "%lf", 1, &rotate1);
     546      status2 = gfits_scan (header, "CROTA2", "%lf", 1, &rotate2);
     547      status &= status1 || status2;
     548
     549      rotate = rotate2;
     550      if (status1 && !status2) rotate = rotate1;
     551      if (!status1 && !status2) rotate = 0.0;
     552
    543553      Lambda = coords[0].cdelt2 / coords[0].cdelt1;
    544554      coords[0].pc1_1 =  cos(rotate*RAD_DEG);
Note: See TracChangeset for help on using the changeset viewer.