IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 13, 2006, 5:10:34 PM (20 years ago)
Author:
eugene
Message:

all sorts of error handling fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroWCS.c

    r9373 r9574  
    66
    77    psProjectionType type;
    8     bool status;
     8    bool status, pcKeys, cdKeys;
    99    float crval1, crval2, crpix1, crpix2, cdelt1, cdelt2;
    1010    float pc1_1, pc1_2, pc2_1, pc2_2;
     
    2929    }
    3030
     31    // what type of WCS keywords are available?
     32    psMetadataLookupF32 (&pcKeys, header, "PC001001");
     33    psMetadataLookupF32 (&cdKeys, header, "CD1_1");
     34
     35    if (cdKeys && pcKeys) {
     36        psLogMsg ("psastro", 2, "warning: both CDi_j and PC00i00j defined in headers, using CDi_j terms\n");
     37    }
     38    if (!cdKeys && !pcKeys) {
     39        psError(PS_ERR_UNKNOWN, true, "missing both CDi_j and PC00i00j WCS terms");
     40        // XXX we could default here to RA, DEC, ROTANGLE
     41        return false;
     42    }
     43
    3144    crval1 = psMetadataLookupF32 (&status, header, "CRVAL1");
    3245    crval2 = psMetadataLookupF32 (&status, header, "CRVAL2");
     
    3548   
    3649    // test the CDELTi varient
    37     cdelt1 = psMetadataLookupF32 (&status, header, "CDELT1");
    38     if (status) {
     50    if (pcKeys) {
     51        cdelt1 = psMetadataLookupF32 (&status, header, "CDELT1");
    3952        cdelt2 = psMetadataLookupF32 (&status, header, "CDELT2");
    4053
     
    6578
    6679    // test the CDi_j varient
    67     pc1_1 = psMetadataLookupF32 (&status, header, "CD1_1");
    68     if (status) {
     80    if (cdKeys) {
     81        pc1_1 = psMetadataLookupF32 (&status, header, "CD1_1");
    6982        pc1_2 = psMetadataLookupF32 (&status, header, "CD1_2");
    7083        pc2_1 = psMetadataLookupF32 (&status, header, "CD2_1");
Note: See TracChangeset for help on using the changeset viewer.