def world_axis_physical_types(self): """ Returns an iterable of strings describing the physical type for each world axis. The strings conform to the International Virtual Observatory Alliance standard, UCD1+ controlled Vocabulary. For a description of the standard and definitions of the different strings and string components, see http://www.ivoa.net/documents/latest/UCDlist.html. """ ctype = list(self.wcs.wcs.ctype) axes_ctype = [] for i, axis in enumerate(self.missing_axis): if not axis: # Find keys in wcs_ivoa_mapping dict that represent start of CTYPE. # Ensure CTYPE is capitalized. keys = list( filter(lambda key: ctype[i].upper().startswith(key), wcs_ivoa_mapping)) # If there are multiple valid keys, raise an error. if len(keys) != 1: raise ValueError( "Non-unique CTYPE key. Please raise an issue at " "https://github.com/sunpy/ndcube/issues citing the" "following CTYPE and non-unique keys: " "CTYPE = {0}; keys = {1}".format(ctype[i], keys)) else: key = keys[0] axes_ctype.append(wcs_ivoa_mapping.get(key, default=None)) return tuple(axes_ctype[::-1])
def world_axis_physical_types(self): """ Returns an iterable of strings describing the physical type for each world axis. The strings conform to the International Virtual Observatory Alliance standard, UCD1+ controlled Vocabulary. For a description of the standard and definitions of the different strings and string components, see http://www.ivoa.net/documents/latest/UCDlist.html. """ ctype = list(self.wcs.wcs.ctype) axes_ctype = [] for i, axis in enumerate(self.missing_axis): if not axis: key = ctype[i] if "-TAN" in key: key = key[:-4] axes_ctype.append(wcs_ivoa_mapping.get(key, default=None)) return tuple(axes_ctype[::-1])
def world_axis_physical_types(self): """ Returns an iterable of strings describing the physical type for each world axis. The strings conform to the International Virtual Observatory Alliance standard, UCD1+ controlled Vocabulary. For a description of the standard and definitions of the different strings and string components, see http://www.ivoa.net/documents/latest/UCDlist.html. """ ctype = list(self.wcs.wcs.ctype) axes_ctype = [] for i, axis in enumerate(self.missing_axis): if not axis: # Find keys in wcs_ivoa_mapping dict that represent start of CTYPE. # Ensure CTYPE is capitalized. keys = list( filter(lambda key: ctype[i].upper().startswith(key), wcs_ivoa_mapping)) # Assuming CTYPE is supported by wcs_ivoa_mapping, use its corresponding axis name. if len(keys) == 1: axis_name = wcs_ivoa_mapping.get(keys[0]) # If CTYPE not supported, raise a warning and set the axis name to CTYPE. elif len(keys) == 0: warnings.warn( "CTYPE not recognized by ndcube. " "Please raise an issue at " "https://github.com/sunpy/ndcube/issues citing the " "unsupported CTYPE as we'll include it: " "CTYPE = {0}".format(ctype[i])) axis_name = "custom:{0}".format(ctype[i]) # If there are multiple valid keys, raise an error. else: raise ValueError( "Non-unique CTYPE key. Please raise an issue at " "https://github.com/sunpy/ndcube/issues citing the " "following CTYPE and non-unique keys: " "CTYPE = {0}; keys = {1}".format(ctype[i], keys)) axes_ctype.append(axis_name) return tuple(axes_ctype[::-1])
def world_axis_physical_types(self): """ Returns an iterable of strings describing the physical type for each world axis. The strings conform to the International Virtual Observatory Alliance standard, UCD1+ controlled Vocabulary. For a description of the standard and definitions of the different strings and string components, see http://www.ivoa.net/documents/latest/UCDlist.html. """ ctype = list(self.wcs.wcs.ctype) axes_ctype = [] for i, axis in enumerate(self.missing_axes): if not axis: # Find keys in wcs_ivoa_mapping dict that represent start of CTYPE. # Ensure CTYPE is capitalized. keys = list(filter(lambda key: ctype[i].upper().startswith(key), wcs_ivoa_mapping)) # Assuming CTYPE is supported by wcs_ivoa_mapping, use its corresponding axis name. if len(keys) == 1: axis_name = wcs_ivoa_mapping.get(keys[0]) # If CTYPE not supported, raise a warning and set the axis name to CTYPE. elif len(keys) == 0: warnings.warn("CTYPE not recognized by ndcube. " "Please raise an issue at " "https://github.com/sunpy/ndcube/issues citing the " "unsupported CTYPE as we'll include it: " "CTYPE = {0}".format(ctype[i])) axis_name = "custom:{0}".format(ctype[i]) # If there are multiple valid keys, raise an error. else: raise ValueError("Non-unique CTYPE key. Please raise an issue at " "https://github.com/sunpy/ndcube/issues citing the " "following CTYPE and non-unique keys: " "CTYPE = {0}; keys = {1}".format(ctype[i], keys)) axes_ctype.append(axis_name) return tuple(axes_ctype[::-1])