#759 closed defect (fixed)
psFitsReadHeader fails to handle NaN cards
| Reported by: | Owned by: | Paul Price | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | fits | Version: | 0.11.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
A fits header card such as
RA = NaN / 1st row - Right ascension of telescope boresigh
are read without complaint as S16 (== 'I').
The problem is that cfitsio routine fits_get_keytype doesn't complain.
N.b. note that this routine is also called by psMetadataReadHeader()
Change History (5)
comment:1 by , 20 years ago
| Owner: | changed from to |
|---|
comment:2 by , 20 years ago
| Cc: | added |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
This is principally due to a deficiency in cfitsio. We have plans to upgrade to
our own FITS reader in the future, but we have more immediate priorities.
I tried reading a FITS header that contains NaN and Inf, but these are both
converted to zero. fits_get_keytype reports that "nan" is a short int (the
default, "I've no idea what this is" type). I added filters to the parsing of
this type in psFitsReadHeader to trap NAN, INF and -INF, and add them as F32
types to the metadata. I'm not 100% happy with the solution (the problem is
mostly cfitsio's), but the result is that we can now read these values successfully.
The FITS header contains:
FOONAN = nan /
FOOINF = inf /
Using psFitsReadHeader, and psMetadataPrint:
FOONAN: nan
FOOINF: inf
Updated the code in CVS head.
Note also bug 760 --- writing NaN or Inf to a FITS header as a floating-point
type is impossible with cfitsio.
comment:3 by , 20 years ago
Removed psMetadataReadHeader --- this function is no longer in the SDRS, and its
functionality has been replaced by psFitsReadHeader.
Changed in CVS head.

I'll take a look into this.