| |
- rho(p_in, Tv_in, missing=1e+20)
- Calculate air density (including moisture effects).
Method Arguments:
* p_in: Pressure [hPa]. Required.
* Tv_in: Virtual temperature [K]. Required.
* missing: If p_in and/or Tv_in has missing values, this is the
missing value value. Floating point scalar. Default is 1e+20.
p_in and Tv_in are Numeric floating point arrays of any number of
dimensions and size, as long as they are of the same size and
shape (or one of them is of size 1).
Output:
* Air density [kg/m**3]. Numeric array of same dimensions and
size as input. 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.
Reference:
* Wallace, J. M., and P. V. Hobbs (1977): Atmospheric Science:
An Introductory Survey. San Diego, CA: Academic Press, ISBN
0-12-732950-1, p. 52.
Example without missing values:
>>> from rho import rho
>>> import Numeric as N
>>> p = N.array([1000.0, 800., 500.])
>>> Tv = N.array([273.15, 280., 290.])
>>> a = rho(p, Tv)
>>> ['%.8g' % a[i] for i in range(len(a))]
['1.2753848', '0.99534675', '0.60064028']
Example with missing values:
>>> p = N.array([1000.0, 1e+28, 500.])
>>> Tv = N.array([273.15, 280., 290.])
>>> a = rho(p, Tv, missing=1e+28)
>>> ['%.8g' % a[i] for i in range(len(a))]
['1.2753848', '1e+28', '0.60064028']
|