Skip to content

robwarrenwx/atmos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

atmos: fast and accurate calculations for applications in atmospheric science

atmos is a Python library for computing physical quantities commonly used in atmospheric science. The code comprises the following modules:

  • thermo - functions for calculating various thermodynamic variables (density, wet-bulb temperature, potential temperature, etc.)
  • moisture - functions for convecting between different measures of atmospheric moisture (specific humidity, relative humidity, dewpoint temperature, etc.)
  • parcel - functions for performing adiabatic and pseudoadiabatic parcel ascents to calculate CAPE and CIN
  • kinematic - functions for converting between wind speed/direction and u/v and for calculating kinematic quantities (bulk wind difference, storm-relative helicity, etc.)
  • pseudoadiabat - functions for performing fast pseudoadiabatic calculations (see below)
  • utils - generic functions for peforming interpolation and layer averaging of scalar and vector quantities

All of the thermodynamic equations in atmos are analytical and derived from a common set of assumptions (the so-called Rankine-Kirchhoff approximations; Romps, 2021); no empirical formulae are used. Another novel feature is the treatment of saturation, which can be represented with respect to liquid, ice, or a combination of the two (via the phase argument). A new treatment of mixed-phase saturation has been developed, which is documented in a paper published in the Quarterly Journal of the Royal Meteorological Society (Warren 2024).

To speed up pseudoadiabatic parcel calculations, atmos uses high-order polynomial fits to (i) parcel temperature as a function of wet-bulb potential temperature (WBPT) and pressure and (ii) WBPT as a function of parcel temperature and pressure following Moisseeva and Stull (2017). This is also the basis for the Noniterative Evaluation of Wet-bulb Temperature (NEWT) method, which was advertised by my colleague Cass Rogers at the 2023 AGU Annual Meeting (Rogers and Warren, 2023). The NEWT method and its performance relative to other approximate methods for calculating wet-bulb temperature will be presented in a forthcoming paper. Code to perform the polynomial fits and for generating the "pseudoadiabat" module, which applies them, can be found in the "pseudoadiabat_codegen" directory. Note that, at present, the polynomial approach is only available for liquid pseudoadiabats (phase="liquid") as it seems to introduce unacceptably large errors for ice and mixed-phase pseudoadiabats. In the future, I would like to explore the use of Symbolic Regression as an alternative to the high-order polynomial fits. However, for now, ice and mixed-phase pseudoadiabatic parcel calculations must be performed using direct integration of the pseudoadiabatic lapse rate equation (by setting polynomial=False). Calculations involving saturated adiabats are performed this way by default due to the additional dependence on total water mass fraction.

The development of atmos has been something of a side project for me and, as yet, I have not had time to create unit tests in order to rigorously test the code. As such it is possible (likely even) that some bugs are present. If you identify one please raise an issue and I will aim to fix it ASAP. That said, users should find that the code is well commented and easy to read. The choice of variable names and the formatting of equations matches more or less exactly the notation in my 2024 paper on mixed-phase saturation, which should make it easy to understand the origins of each function.

In the near future, I plan to add a handful of demonstration notebooks to the repository, which will illustrate some of the functionality of atmos. If you have any suggestions for new features you would like to see added, please don't hesitate to get in touch.

Rob Warren (21-02-2025)

About

Fast and accurate calculations for applications in atmospheric science

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages