diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-12-07 21:03:12 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-12-07 21:03:12 (GMT) |
commit | 623ca5970335961993449414d54b605e54988f8b (patch) | |
tree | 2c5cb921b99d803ff0b00fa23486a32f3bffc2c1 /tksao/frame | |
parent | 8acebcdabd19bc143ba8cf984fef03b6d991fd9f (diff) | |
download | blt-623ca5970335961993449414d54b605e54988f8b.zip blt-623ca5970335961993449414d54b605e54988f8b.tar.gz blt-623ca5970335961993449414d54b605e54988f8b.tar.bz2 |
update AST WCS
Diffstat (limited to 'tksao/frame')
-rw-r--r-- | tksao/frame/fitsimage.C | 95 |
1 files changed, 57 insertions, 38 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C index 2ec940f..6831351 100644 --- a/tksao/frame/fitsimage.C +++ b/tksao/frame/fitsimage.C @@ -3466,22 +3466,26 @@ int FitsImage::hasWCS(Coord::CoordSystem sys) astBegin; int ss = sys-Coord::WCS; - int rr =0; - int nn = astGetI(newast_,"nframe"); + int nn = astGetI(newast_, "Nframe"); char cc = ' '; if (ss) cc = ss+'@'; for (int ii=0; ii<nn; ii++) { - const char* id = astGetC(astGetFrame(newast_,ii+1),"Ident"); - if (cc == id[0]) { - rr =1; - break; + const char* id = astGetC(astGetFrame(newast_,ii+1), "Ident"); + if (id && *id && cc == id[0]) { + astEnd; + return 1; } } - astEnd; // now, clean up memory - return rr; + astEnd; + + // if newast_, sys= WCS, and no Ident, then must be AST + if (sys == Coord::WCS) + return 1; + + return 0; } int FitsImage::hasWCSEqu(Coord::CoordSystem sys) @@ -3493,8 +3497,7 @@ int FitsImage::hasWCSEqu(Coord::CoordSystem sys) astBegin; int ss = sys-Coord::WCS; - int rr =0; - int nn = astGetI(newast_, "nframe"); + int nn = astGetI(newast_, "Nframe"); char cc = ' '; if (ss) cc = ss+'@'; @@ -3502,37 +3505,45 @@ int FitsImage::hasWCSEqu(Coord::CoordSystem sys) for (int ii=0; ii<nn; ii++) { AstFrame* ff = (AstFrame*)astGetFrame(newast_,ii+1); const char* id = astGetC(ff, "Ident"); - if (cc == id[0]) { - + if (id && *id && cc == id[0]) { int naxes = astGetI(ff, "Naxes"); switch (naxes) { case 2: - rr = astIsASkyFrame(ff); - break; + { + int rr = astIsASkyFrame(ff); + // check for xLON/xLAT and xxLN/xxLT + // but GLON/GLAT is ok + const char* str = astGetC(ff, "System"); + if (!strncmp(str,"Unknown",7)) + rr = 0; + + astEnd; + return rr; + } case 3: case 4: { char* domain = (char*)astGetC(ff, "Domain"); char* sky = strstr(domain, "SKY"); - rr = sky ? 1 : 0; + astEnd; + return sky ? 1 : 0; } - break; default: - rr =0; - break; + astEnd; + return 0; } - - // check for xLON/xLAT and xxLN/xxLT - // but GLON/GLAT is ok - const char* str = astGetC(ff, "System"); - if (!strncmp(str,"Unknown",7)) - rr =0; - break; } } - astEnd; // now, clean up memory - return rr; + // if newast_, sys= WCS, and no Ident, then must be AST + if (sys == Coord::WCS) { + int rr = astIsASkyFrame(astGetFrame(newast_, AST__CURRENT)); + astEnd; + return rr; + } + + astEnd; + return 0; } int FitsImage::hasWCSCel(Coord::CoordSystem sys) @@ -3544,7 +3555,6 @@ int FitsImage::hasWCSCel(Coord::CoordSystem sys) astBegin; int ss = sys-Coord::WCS; - int rr =0; int nn = astGetI(newast_, "nframe"); char cc = ' '; if (ss) @@ -3553,31 +3563,40 @@ int FitsImage::hasWCSCel(Coord::CoordSystem sys) for (int ii=0; ii<nn; ii++) { AstFrame* ff = (AstFrame*)astGetFrame(newast_,ii+1); const char* id = astGetC(ff, "Ident"); - if (cc == id[0]) { - + if (id && *id && cc == id[0]) { int naxes = astGetI(ff, "Naxes"); switch (naxes) { case 2: - rr = astIsASkyFrame(ff); - break; + { + int rr = astIsASkyFrame(ff); + astEnd; + return rr; + } case 3: case 4: { char* domain = (char*)astGetC(ff, "Domain"); char* sky = strstr(domain, "SKY"); - rr = sky ? 1 : 0; + astEnd; + return sky ? 1 : 0; } - break; default: - rr =0; - break; + astEnd; + return 0; } break; } } - astEnd; // now, clean up memory - return rr; + // if newast_, sys= WCS, and no Ident, then must be AST + if (sys == Coord::WCS) { + int rr = astIsASkyFrame(astGetFrame(newast_, AST__CURRENT)); + astEnd; + return rr; + } + + astEnd; + return 0; } #endif |