summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhack <hack@stsci.edu>2011-11-16 15:07:55 -0500
committerhack <hack@stsci.edu>2011-11-16 15:07:55 -0500
commit0f3e78c160bd407e37ee1b094140b88fe6b8022b (patch)
treef713ee980a814934480079d1502590101b8d0e14
parentc3a8a79697b724cb51c955c0f52046036f7f6139 (diff)
downloadstwcs_hcf-0f3e78c160bd407e37ee1b094140b88fe6b8022b.tar.gz
The 'archiveWCS' function in wcsutil.altwcs did not always find a WCSNAME, especially when previous use of (older) updatewcs code did not define the keyword. A default name of 'DEFAULT' now gets defined when this code runs. This code was tested against the WFC3/IR data from the adrizzle test data.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@14017 fe389314-cf27-0410-b35b-8c050e845b92
-rw-r--r--lib/stwcs/wcsutil/altwcs.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/stwcs/wcsutil/altwcs.py b/lib/stwcs/wcsutil/altwcs.py
index d54bde9..064b2ca 100644
--- a/lib/stwcs/wcsutil/altwcs.py
+++ b/lib/stwcs/wcsutil/altwcs.py
@@ -95,7 +95,20 @@ def archiveWCS(fname, ext, wcskey=" ", wcsname=" ", reusekey=False):
wname = wcsname
else:
# determine which WCSNAME needs to be replicated in archived WCS
- wname = wcsnames(f[wcsext].header)[' ']
+ wnames = wcsnames(f[wcsext].header)
+ if 'O' in wnames: del wnames['O'] # we don't want OPUS/original
+ if len(wnames) > 0:
+ if ' ' in wnames:
+ wname = wnames[' ']
+ else:
+ akeys = string.uppercase
+ wname = "DEFAULT"
+ for key in akeys[-1::]:
+ if key in wnames:
+ wname = wnames
+ break
+ else:
+ wname = "DEFAULT"
else:
wkey = wcskey
wname = wcsname