diff options
author | Nadia Dencheva <nadia.astropy@gmail.com> | 2017-04-24 20:27:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-24 20:27:39 -0400 |
commit | c956b066bd3f9e60491a8258a14c2028f713d23b (patch) | |
tree | 5984d868fd456020c640d406a90726c74b6c47f2 /stwcs/wcsutil/altwcs.py | |
parent | 53494790dfa08265eeea23b5e659f1ac157a1490 (diff) | |
parent | 95e84f773a7254f7a07d7393c9dd3828ff8c5662 (diff) | |
download | stwcs_hcf-c956b066bd3f9e60491a8258a14c2028f713d23b.tar.gz |
suppress warning messages when it's known they are not relevant
Diffstat (limited to 'stwcs/wcsutil/altwcs.py')
-rw-r--r-- | stwcs/wcsutil/altwcs.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/stwcs/wcsutil/altwcs.py b/stwcs/wcsutil/altwcs.py index 1988d36..19c483f 100644 --- a/stwcs/wcsutil/altwcs.py +++ b/stwcs/wcsutil/altwcs.py @@ -1,6 +1,7 @@ from __future__ import absolute_import, division, print_function import string +import warnings import numpy as np from astropy import wcs as pywcs from astropy.io import fits @@ -9,6 +10,13 @@ from stsci.tools import fileutil as fu from astropy import log default_log_level = log.getEffectiveLevel() +warnings.filterwarnings("ignore", message="^Some non-standard WCS keywords were excluded:", module="astropy.wcs.wcs") + + +__all__ = ["archiveWCS", "available_wcskeys", "convertAltWCS", "deleteWCS", "next_wcskey", + "pc2cd", "readAltWCS", "restoreWCS", "wcskeys", "wcsnames"] + + altwcskw = ['WCSAXES', 'CRVAL', 'CRPIX', 'PC', 'CDELT', 'CD', 'CTYPE', 'CUNIT', 'PV', 'PS'] altwcskw_extra = ['LATPOLE', 'LONPOLE', 'RESTWAV', 'RESTFRQ'] @@ -432,10 +440,9 @@ def _restore(fobj, ukey, fromextnum, hdr = _getheader(fobj, fromextension) # keep a copy of the ctype because of the "-SIP" suffix. ctype = hdr['ctype*'] + w = pywcs.WCS(hdr, fobj, key=ukey) - log.setLevel('WARNING') hwcs = w.to_header() - log.setLevel(default_log_level) if hwcs is None: return @@ -518,9 +525,7 @@ def readAltWCS(fobj, ext, wcskey=' ', verbose=False): print('readAltWCS: Could not read WCS with key %s' % wcskey) print(' Skipping %s[%s]' % (fobj.filename(), str(ext))) return None - log.setLevel('WARNING') hwcs = nwcs.to_header() - log.setLevel(default_log_level) if nwcs.wcs.has_cd(): hwcs = pc2cd(hwcs, key=wcskey) |