Spectral¶
- class pyrt.observation.Spectral(short_wavelength, long_wavelength)[source]¶
A data structure that contains spectral information required by DISORT.
It accepts the short and long wavelengths from an observation and computes their corresponding wavenumbers. It can accommodate arrays of any shape as long as they have the same shape.
- Parameters
short_wavelength (ArrayLike) – The short wavelength [microns] of each spectral bin.
long_wavelength (ArrayLike) – The long wavelength [microns] of each spectral bin.
- Raises
TypeError – Raised if any values in the input arrays are nonnumerical.
ValueError – Raised if either of the input arrays are not the same shape, if any values in
short_wavelengthare not larger than the corresponding values inlong_wavelength, or if either of the input arrays contain values outside of 0.1 to 50 microns (I assume this is the valid range to do retrievals).
Notes
If you do not plan to use thermal emission, there is probably little benefit to making an instance of this class. See
ThermalEmissionfor a discussion on thermal radiation in DISORT.See also
constant_widthCreate instances of this class if the wavelengths are equally spaced.
Examples
Import the relevant modules
>>> import numpy as np >>> from pyrt.observation import Spectral
Instantiate this class for a simple set of wavelengths.
>>> short = np.array([9, 10]) >>> long = short + 1 >>> Spectral(short, long) Spectral: low_wavenumber = [1000. 909.09090909] high_wavenumber = [1111.11111111 1000. ]
Instantiate this class for measurements taken at 1 to 30 microns in 1 micron increments, with each channel having a 50 nm spectral width.
>>> center = np.linspace(1, 30, num=30) >>> half_width = 0.05 / 2 >>> wavelengths = Spectral(center - half_width, center + half_width) >>> wavelengths.low_wavenumber.shape (30,)
Instantiate this class for an image of shape (50, 60), where each pixel contains the same 20 wavelengths—wavelengths that span 1 to 20 microns in 1 micron increments with each channel having a 50 nm spectral width. Note that this is not memory efficient, as each pixel along the “measurement shape” contains the same information, but it may be useful for keeping as many arrays as possible equally shaped.
>>> center = np.linspace(1, 20, num=20) >>> half_width = 0.05 / 2 >>> wav_grid = np.broadcast_to(center, (50, 60, 20)) >>> wavelengths = Spectral(wav_grid - half_width, wav_grid + half_width) >>> wavelengths.low_wavenumber.shape (50, 60, 20) >>> np.array_equal(wavelengths.low_wavenumber[0, 0, :], ... wavelengths.low_wavenumber[9, 17, :]) True
- property high_wavenumber: numpy.ndarray¶
Get the high wavenumber [cm -1]—the wavenumber corresponding to
short_wavelength.Notes
Each element along the observation dimension(s) is named
WVNMHIin DISORT. It is only needed by DISORT ifthermal_emissionis set toTrue.
- property low_wavenumber: numpy.ndarray¶
Get the low wavenumber [cm -1]—the wavenumber corresponding to
long_wavelength.Notes
Each element along the observation dimension(s) is named
WVNMLOin DISORT. It is only needed by DISORT ifthermal_emissionis set toTrue.