Skip to content

Fast and accurate calculations for applications in atmospheric science

Notifications You must be signed in to change notification settings

robwarrenwx/atmos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 

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. Currently, the code comprises vectorised functions for calculating a wide array of thermodynamic variables (the "thermo" module), for converting between different measures of atmospheric moisture (the "moisture" module), and for performing adiabatic/pseudoadiabatic parcel ascents to calculate CAPE and CIN (the "parcel" module). All of the equations are analytical and derived from a common set of assumptions (the so-called Rankine-Kirchhoff approximations; Romps, 2021); no empirical equations 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 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 plan 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. An additional module to calculate kinematic parameters, such as bulk wind difference and storm-relative helicity, may also be added further down the line. If you have any suggestions for new features you would like to see added, please don't hesitate to get in touch.

Rob Warren (25-11-2024)

About

Fast and accurate calculations for applications in atmospheric science

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages