Equation of State¶
The eos module contains data structures to compute and hold equation
of state variables used throughout pyRT_DISORT.
- class pyrt.eos.Hydrostatic(altitude_grid, pressure_grid, temperature_grid, altitude_boundaries, particle_mass, gravity)[source]¶
A data structure that computes a hydrostatic equation of state.
Hydrostatic accepts equation of state variables and regrids them to a user-specified altitude grid using linear interpolation. Then, it computes number density and scale height at the new boundaries, and the column density within the new boundaries, assuming the atmosphere is in hydrostatic equilibrium.
- Parameters
altitude_grid (numpy.ndarray) – The altitude grid [km] over which the equation of state variables are defined. See the note below for additional conditions.
pressure_grid (numpy.ndarray) – The pressure [Pa] at all values in
altitude_grid.temperature_grid (numpy.ndarray) – The temperature [K] at all values in
altitude_grid.altitude_boundaries (numpy.ndarray) – The desired boundary altitude [km]. See the note below for additional conditions.
particle_mass (float) – The average mass [kg] of atmospheric particles.
gravity (float) – The gravitational acceleration [\(\frac{\text{kg m}}{\text{s}^2}\)] of the atmosphere.
- Raises
TypeError – Raised if
altitude_grid,pressure_grid,temperature_grid, oraltitude_boundariesare not all numpy.ndarrays; or ifparticle_massorgravityare not floats.ValueError – Raised if: *
altitude_grid,pressure_grid, ortemperature_griddo not have the same shapes *altitude_gridoraltitude_boundarieshave incompatible pixel dimensions *altitude_gridoraltitude_boundariesare not monotonically decreasing along the 0 th axis; *pressure_grid, ortemperature_gridcontain non-positive, finite values *altitude_boundariesdoes not contain at least 2 boundaries *particle_massorgravityare not positive, finite
- Return type
None
Notes
This class assumes the atmosphere follows the equation
(1)¶\[P = n k_B T\]where \(P\) is the pressure, \(n\) is the number density, \(k_B\) is Boltzmann’s constant, and \(T\) is the temperature.
The inputs can be ND arrays, as long as they have compatible shapes. In this scenario,
altitude_grid,pressure_grid, andtemperature_gridmust be of shape Mx(pixels) whereasaltitude_boundariesmust be of shape Nx(pixels), as long as N > 1 to ensure that the model has at least 1 layer.To keep with DISORT’s convention,
altitude_gridandaltitude_boundariesmust be monotonically decreasing. If these are ND arrays, this condition only applies to the 0 th axis.Also, scipy’s Gaussian quadrature routine becomes less accurate the smaller the atmosphere’s scale height is. I’m working to reduce the errors. In the meantime the column density is fairly close to analytical results but should be improved.
- property altitude: numpy.ndarray¶
Get the input boundary altitude [km].
- property column_density: numpy.ndarray¶
Get the column density [\(\frac{\text{particles}}{\text{m}^2}\)] of the boundary layers.
Notes
This is obtained by getting the number density at the boundary altitude, then integrating (using Gaussian quadrature) between the boundary altitude such that
\[N = \int n(z) dz\]is satisfied, where \(N\) is the column density and \(n(z)\) is the number density.
- property n_layers: int¶
Get the number of layers in the model.
Notes
This value is inferred from the 0 th axis of
altitude_boundaries.In DISORT, this variable is named
MAXCLY(though in thedisortpackage, this variable is optional).
- property number_density: numpy.ndarray¶
Get the number density [\(\frac{\text{particles}}{\text{m}^3}\)] at the boundary altitude.
Notes
This variable is obtained by getting the pressure and temperature at the boundary altitude, then solving (1).
- property pressure: numpy.ndarray¶
Get the pressure [Pa] at the boundary altitude.
Notes
This variable is obtained by linearly interpolating the input pressure onto
altitude_boundaries.
- property scale_height: numpy.ndarray¶
Get the scale height [km] at the boundary altitude.
Notes
For a hydrostatic atmosphere, the scale height is defined as
\[H = \frac{k_B T}{mg}\]where \(H\) is the scale height, \(k_B\) is Boltzmann’s constant, \(T\) is the temperature, \(m\) is the average mass of an atmospheric particle, and \(g\) is the planetary gravity.
In DISORT, this variable is named
H_LYR. Despite the name, this variable should have length ofn_layers + 1. It is only used ifdo_pseudo_sphereis set toTrue.
- property temperature: numpy.ndarray¶
Get the temperature [K] at the boundary altitude.
Notes
This variable is obtained by linearly interpolating the input temperature onto
altitude_boundaries.In DISORT, this variable is named
TEMPER. It is only needed by DISORT ifthermal_emissionis set toTrue.