summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormcara <mcara@stsci.edu>2014-06-04 00:42:25 -0400
committermcara <mcara@stsci.edu>2014-06-04 00:42:25 -0400
commit6637d499e773ada6d0f9707227b5622ff07b2d32 (patch)
tree8b0806014cf532d6e0c1610baefe1520a415f98b
parent664676db3ae5fb278b8026e5d90834dd6aced4aa (diff)
downloadstwcs_hcf-6637d499e773ada6d0f9707227b5622ff07b2d32.tar.gz
deleteWCS crashes when called on compressed FITS HDU (CompImageHDU) because of a bug in CompImageHDU that does not allow `del` on non-existent header keywords.
For more details see https://github.com/astropy/astropy/issues/2594 git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@32334 fe389314-cf27-0410-b35b-8c050e845b92
-rw-r--r--lib/stwcs/wcsutil/altwcs.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/stwcs/wcsutil/altwcs.py b/lib/stwcs/wcsutil/altwcs.py
index befa2bb..bdb9b3b 100644
--- a/lib/stwcs/wcsutil/altwcs.py
+++ b/lib/stwcs/wcsutil/altwcs.py
@@ -350,7 +350,8 @@ def deleteWCS(fname, ext, wcskey=" ", wcsname=" "):
if hwcs is None:
continue
for k in hwcs.keys():
- del hdr[k]
+ if k in hdr:
+ del hdr[k]
#del hdr['ORIENT'+wkey]
prexts.append(i)
if prexts != []: