pyrt.column_density#

pyrt.column_density(pressure, temperature, altitude)[source]#

Create the column density from a given grid of equation of state variables, assuming each grid point can be hydrostatically approximated.

Parameters:
  • pressure (ArrayLike) – The 1-dimensional pressure [Pa] of the grid.

  • temperature (ArrayLike) – The 1-dimensional temperature [K] of the grid.

  • altitude (ArrayLike) – The 1-dimensional altitude [m] of each point in the grid. It must be monotonically decreasing, otherwise this function will give nonsense.

Returns:

  • The column density [\(\frac{\text{particles}}{m^2}\)] of each point in

  • the vertical column.

Return type:

ndarray

Notes

This function assumes the ideal gas law applies to each point in the grid. Additionally, it linearly interpolates each grid point vertically so that it can do the vertical integration, which may or may not be desirable if the pressure varies exponentially. The finer the vertical resolution, the more accurate this function will be.

Examples

Get the column density of each 1 km layer of an 80-boundary atmosphere representing Mars where the surface pressure is 600 Pa, the temperature is 180 K everywhere, and the scale height is 10 km.

>>> import numpy as np
>>> from scipy.constants import Boltzmann
>>> import pyrt
>>> altitude = np.linspace(80000, 0, num=81)
>>> pressure = 600 * np.exp(-altitude / 10000)
>>> temperature = np.ones((81,)) * 180
>>> colden = column_density(pressure, temperature, altitude)
>>> colden.shape
(80,)

Get the column-integrated column density.

>>> total_colden = np.sum(colden)
>>> f'{total_colden:.2e}'
'2.42e+27'

Compute the analytical result of this scenario.

>>> analytical_result = 600 * 10000 * (1 - np.exp(-80000/10000)) / 180 / Boltzmann
>>> f'{analytical_result:.2e}'
'2.41e+27'