Basic IDL routines for atmospheric science applications

(c) 2001-2004: Dominik Brunner, Institute for Atmospheric and Climate Science, ETH Zurich, Switzerland  (dominik DOT brunner AT env.ethz.ch)

The following is a collection of (nearly self-consistent) routines useful in atmospheric science. The routines can be downloaded individually or all together as a compressed zip (Windows) or gzip/tar (UNIX) file.


Klick here to download complete program package



Select one of the following program categories

I: Basic atmospheric physics and thermodynamics
II: Water vapor in the air
III: Soundings
IV: Basic plotting tools
V: Satellite imagery
 

Variable name convention used in the routines (incomplete list)

T, TC Temperature in deg Celsius p pressure
T, TK Temperature in Kelvin e water vapor pressure
Q specific humidity (g H2O/kg humid air) esat saturation vapor pressure over liquid water
W, MIXR water vapor mixing ratio (g H2O/kg dry air) eice saturation vapor pressure over ice
Tdew dew point temperature (K) u, v, w The eastward, northward and upward wind components
Tfrost frost point temperature (K) wangle wind angle
Tw Wet bulb temperature wspeed wind speed
Theta potential temperature    
Tv virtual temperature    

 

I: Basic atmospheric physics and thermodynamics

Routine Input parameters
A(*)
Description
atmos_const.pro none   Creates a set of constants in a new IDL environment variable !atmos. Type "help, !atmos,/st" after calling atmos_const to see contents of new variable.
theta.pro p (hPa), T (C)
x
Calculates potential temperature from given pressure and temperature
air_density.pro p (hPa), TK (K)
x
Calculates air density in terms of kg/m3
molecpercm3.pro p (hPa), TK (K)
x
Calculates air density in terms of molecules per cm3
zenith.pro UTC, lat, lon
x
Calculates solar zenith angle
windangle.pro u (m/s), v(m/s)
x
Calculates wind angle (deg) and optionally wind speed from given u and v. The windangle is taken (as usual in atmospheric physics) clockwise from north. I.e. a wind blowing from the west has an angle of 270deg.
winduv.pro wangle (deg), wspeed (determines unit of output)
x
Calculates the east and north directing components of the wind vector
geopotential.pro(1) p (hPa), T (K), W (g/kg), surface_height (m)
x
Calculates the geopotential or geopotential heights using the hypsometric equation (also suitable for calculations on 3D input fields)
press2alt.pro p (hPa) or altitude (m)
x
Calculates the altitute (m) for a given pressure level or (if keyword /invert is set) the reverse, i.e. the pressure for a given altitude level, assuming the US/ICAO standard atmosphere
alt2press.pro (pressure-) altitude (m)
x
Computes the pressure from given altitudes assuming the US/ICAO standard atmosphere (i.e. the reverse of press2alt)
alt2temp.pro (pressure-) altitude (m)
x
Computes temperature at given altitudes assuming the US/ICAO standard atmosphere.

(*) This column describes whether the routine accepts arrays as input or not.
(1) Adapted from Paul van Delst.
 

II:  Water vapor in the air

Routine Input parameters
A(*)
Description
T_virtual.pro T (K), p (hPa), e (hPa)
x
Calculates virtual temperature (the temperature moist air must have to have the same density as dry air at temperature T and pressure p)
esat.pro T (K, C)
 x
Computes saturation vapor pressure over liquid water at given T following formula by Goff and Gratch (recommended by WMO)
eice.pro T (K, C)
 x
Computes saturation vapor pressure over ice at given T following Marti and Mauersberger, GRL 20, 363-366, 1993.
tdew2rh.pro Tdew (K, C), T (K, C)
x
Computes the relative humidity over water (or over ice if keyword /ice is used) given the dew point temperature and the dry air temperature.
rh2tdew.pro T (K, C), RH (%)
x
Computes the dew-point (or frost point) temperature given the dry air temperature and the relative humidity over water (or optionally over ice, if keyword /ice is set). Note, rh2tdew is the reverse of tdew2rh only to a good approximation.
mixr2rh.pro MIXR (g/kg), p (hPa), T (K, C)
x
Computes the relative humidity in percent over water (optionally over ice) given the mass mixing ratio (g H2O per kg dry air), pressure and temperature
rh2mixr.pro RH (%), p (hPa), T (K, C)
x
Computes the mass mixing ratio (g H2O per kg dry air) given the relative humidity over water (optionally over ice), pressure and temperature. rh2mixr is the exact reverse of mixr2rh.
mixr2sh.pro MIXR (g/kg)
x
Computes the specific humidity (g H2O per kg of moist air) given the mass mixing ratio (g H2O per kg of dry air)
sh2mixr.pro SH(g/kg)
x
The reverse of mixr2sh.
sh2vmr.pro SH (g/kg)
x
Computes the volume mixing ratio in ppm given the specific humidity in g/kg
mixr2vmr.pro MIXR (g/kg)
x
Computes the volume mixing ratio in ppm given the water vapor mixing ratio in g/kg
rh_wetbulb.pro T (C), Tw (C), p (hPa)
x
Computes the relative humidity given the dry and wet bulb temperature and pressure p
h2o_density.pro TK (K), e (hPa)
x
Computes the density of water vapor given the H2O partial pressure e and temperature T.

III: Soundings

Routine Input parameters
A(*)
Description
cape_sound.pro p (hPa), T (K), MIXR (kg/kg)
Computes CAPE (convective available potential energy) for a given vertical profile of p, T and water vapor mixing ratio.
cape_field.pro same as above, but in 3D
Fast routine to calculate entire 2D distribution of CAPE from 3D input fields of 
skewt.pro(2) see program header   Draws a skew-T/log-p diagram and optionally a sounding of temperature and humidity (as Tdew).
plot_stuve.pro(3) see program header   Draws a Stuve diagram and optionally a sounding of temperature and humidity (as Tdew).
plot_tphi.pro(3) see program header   Draws a Tephigram and optionally a sounding of temperature and humidity (as Tdew)
(1) Original Fortran77 code by Kerry Emanuel, but largely rebuilt to improve speed and capability for vectorization
(2) By Andrew F. Loughe, CIRES/NOAA (afl@cdc.noaa.gov)
(3) Originally by Frank Evans, University of Colorado (evans@nit.colorado.edu)
 

IV: Basic plotting tools

Routine Input parameters
A(*)
Description
colorbar.pro see program header   Draws a vertical or horizontal colorbar. One of many similar programs on the Internet, but I think a really good and flexible one.
wind_barb.pro wspeed, wangle, xpos, ypos [,...]
 
Draws a WMO style wind barb.
plot_legend.pro see program header   Draws a legend on an existing graph.

V: Satellite imagery

Routine Input parameters
A(*)
Description
hip_map_sat.pro see program header   Allows the mapping of satellite images from a number of different geostationary satellites from a large number of different image sources on the Internet (mapping means that a map projection is established in IDL corresponding to the one used for creating the satellite image). Satellite images can be in GIF, JPG, or PNG format. The routine is also part of the HIPHOP visualization tool. 
map_noaa.pro see program header   Map one or a sequence of NOAA polar orbiter satellite images (GAC or LAC) from the NOAA satellite active archive (SAA). The program accepts files from all versions of the satellite including the KLM-series.
The program requires the following subroutines: load_packed_gac, load_gac_klm, load_8bit_lac, load_lac, lac_channel, load_noaa, ARS_HEADER_STRUCT, TBM_HEADER_STRUCT, fill_noaa_info, imagemap. To use map_noaa.pro you therefore need to register and download the entire program package.
imagemap.pro(1) see program header   Display an image which has latitude and longitude defined for
each pixel on a map projection (used e.g. by map_noaa.pro)

(1) by Liam Gumley, CIMSS/SSEC (liam.gumley@ssec.wisc.edu)

Your contribution is highly welcome:
Last update: 1 Aug 2004. Please send comments/questions to dominik dot brunner at env.ethz.ch