spacetelescope / stwcs

WCS based distortion models and coordinate transformation.
http://stwcs.readthedocs.io
4 stars 18 forks source link

Improve handling of primary headers with extver but without extname #179

Closed mcara closed 3 years ago

mcara commented 3 years ago

This PR improves reliability of the code responsible for computing extname property of an HSTWCS object when image's primary header contains 'EXTVER' keyword but is missing 'EXTNAME'. This will allow astrodrizzle to handle such files instead of currently crashing.

nden commented 3 years ago

@mcara Is this PR still relevant? Should it be included in a release?

mcara commented 3 years ago

This extname attribute is used (probably exclusively) by astrodrizzle to find from which extension was the WCS extracted. Some file in the wild were created with an older version of astrodrizzle which was producing these kind of files. This PR makes astrodrizzle more reliable without much harm, I think. For example, if EXTVER was present but EXTNAME was missing, the original code would return ('', None) which I think astrodrizzle converts it to ('', 1) which is not the primary header. This PR would return ('primary', 1) if the WCS was created from the primary header. I do not believe this can cause any issues since this is the correct result.