From 0f3e78c160bd407e37ee1b094140b88fe6b8022b Mon Sep 17 00:00:00 2001 From: hack Date: Wed, 16 Nov 2011 20:07:55 +0000 Subject: 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 --- lib/stwcs/wcsutil/altwcs.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit