Getting started

Atmospheric models can be configured directly using the amwrap.Model class or from standard climatologies using the amwrap.Model.from_climatology constructor, which takes the name of the climatology to be used or an instance of the amwrap.Climatology class. The standard climatologies for the continental United States, i.e., the “US Standard”, “US Midlatitude Winter”, etc. are included from Anderson et al. (1986). The results are returned in a pandas.DataFrame:

import amwrap
m = amwrap.Model.from_climatology("midlatitude_winter")
df = m.run()
df.head()

The atmospheric data in a climatology can be accessed directly from a amwrap.Climatology class instance:

# List available climatologies:
amwrap.Climatology.names
cl = amwrap.Climatology("midlatitude_winter")
dir(cl)      # list attributes
cl.pressure  # access specific quantities

Models can also be constructed directly from astropy.units.Quantity arrays as well. See the documentation for the amwrap.Model class for details on initialization.

m = amwrap.Model(cl.pressure, cl.temperature, {"h2o": cl.mixing_ratio["h2o"]})
df = m.run()  # default is single-threaded with `parallel=False`
df = m.run(parallel=True)  # use number of threads equal to number of CPUs.

Other arguments that can be set include the zenith viewing angle, frequency start, stop, and width, the output quantities, and a scaling factor on the water vapor present in the troposphere.

Output column types for AM include frequency, opacity, transmittance, radiance, radiance difference (against the radiance of the background, by default the CMB), brightness temperature in the full Planck definition, Rayleigh-Jeans brightness temperature, delay, and absorption coeffience. The default outputs are ('frequency', 'brightness temperature', 'opacity', 'delay'). A full list of the output descriptor names and their units can be found in the amwrap.Model.valid_output_descriptors.

Note that input arrays must have approrpiate units associated with them from the AstroPy units package. The following shows an example of using astropy.units.Quantity, for a more complete description of the units system, see the units module documentation. The units can be any particular dimensionally equivalent value. Volumetric mixing ratios are dimensionless and expressed using the astropy.units.dimensionless quantity.

import numpy as np
from astropy import units as u
cl = amwrap.Climatology("midlatitude_winter")
temperature = 5 * u.K * np.ones_like(cl.temperature)
m = amwrap.Model(cl.pressure, temperature, {"h2o": cl.mixing_ratio["h2o"]})
df = m.run()