vapor_press (version 0.2.0.2)
index
vapor_press.py

Single-function module.
 
See function docstring for description.

 
Functions
       
vapor_press(variables, missing=1e+20)
Calculate vapor pressure over liquid water.
 
Method Arguments:
* variables:  A dictionary of input state variables, where for
  each key:value pair the key labels what state variable it is
  and the value is the state variable.  The value is a Numeric
  floating point array of any number of dimensions and size.
  All state variables must be arrays of the same shape and size.
  Argument |variables| can have any number of items.  Key values 
  may be any value, but the values that are understood by this
  function include:
  + 'esat':  Saturation vapor pressure over water [hPa].
  + 'p':  Total pressure [hPa].
  + 'q':  Specific humidity [kg/kg].
  + 'r':  Mixing ratio [kg/kg].
  + 'RH':  Relative humidity (based on esat) [fraction].
* missing:  If any array in |variables| has elements that are
  missing values, this is the missing value value.  Floating 
  point scalar.  Default is 1e+20.
 
Output:
* Vapor pressure [hPa].  Numeric array of same dimensions and 
  size as state variables in the argument.  If there are any
  missing values in output, those values are set to the value
  in argument |missing| from the input.  If there are missing 
  values in the output due to math errors and |missing| is set 
  to None, output will fill those missing values with the MA 
  default value of 1e+20.
 
Vapor pressure can be calculated from a variety of different
combinations of state variables.  In this function, the follow-
ing combinations are supported:
* Mixing ratio and total pressure,
* Specific humidity and total pressure,
* Relative humidity and saturation vapor pressure over water.
The function will automatically apply the correct equation
depending on what key values are available in the |variables| 
dictionary.  An error is returned if none of the above combina-
tions are present in |variables|.
 
References:
* Emanuel, K. A. (1994):  Atmospheric Convection.  New York, NY:
  Oxford University Press, 580 pp.
* Wallace, J. M., and P. V. Hobbs (1977): Atmospheric Science:
  An Introductory Survey.  San Diego, CA:  Academic Press, ISBN
  0-12-732950-1, 467 pp.
 
Example without missing values:
>>> from vapor_press import vapor_press
>>> import Numeric as N
>>> p = N.array([1026.8, 840.2, 640.3, 450.2])
>>> r = N.array([5.5e-3, 5.4e-3, 6.2e-3, 3.9e-3])
>>> e = vapor_press({'p':p, 'r':r})
>>> ['%.9g' % e[i] for i in range(len(e))]
['9.00051379', '7.23209979', '6.31989271', '2.80541885']
 
Example with missing values:
>>> from vapor_press import vapor_press
>>> import Numeric as N
>>> p = N.array([1026.8, 840.2, 1e+20, 450.2])
>>> r = N.array([5.5e-3, 5.4e-3, 6.2e-3, 3.9e-3])
>>> e = vapor_press({'p':p, 'r':r}, missing=1e+20)
>>> ['%.9g' % e[i] for i in range(len(e))]
['9.00051379', '7.23209979', '1e+20', '2.80541885']

 
Data
        __test__ = {'Additional Example 1': "\n >>> from vapor_press import vapor_press\n ...n range(len(e))]\n ['1e+20', '2.80541885']\n ", 'Additional Example 2': "\n >>> from vapor_press import vapor_press\n ...len(e))]\n ['16', '1e+20', '1.05', '0.88']\n "}
__version__ = '0.2.0.2'