extract_waveunit#
- sunpy.io._fits.extract_waveunit(header)[source]#
Attempt to read the wavelength unit from a given FITS header.
- Parameters:
header (
sunpy.io.header.FileHeader
) – OneFileHeader
instance which was created by reading a FITS file. For example,sunpy.io._fits.get_header
returns a list of such instances.- Returns:
str
– The wavelength unit that could be found orNone
otherwise.
Examples
The goal of this function is to return a string that can be used in conjunction with the astropy.units module so that the return value can be directly passed to
astropy.units.Unit
.>>> import astropy.units >>> header = {'WAVEUNIT': 'Angstrom', 'KEYCOMMENTS': {}} >>> waveunit = extract_waveunit(header) >>> if waveunit is not None: ... unit = astropy.units.Unit(waveunit)