Moist Physics
clausius_clapeyron_factor(temp, pressure)
This is the factor \(\alpha\), such that \(dq^*/dT = \alpha q^*\).
I explicitly compute alpha from the formula for saturation_vapor_pressure
in the function here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
temp
|
ndarray
|
Temperature at each coordinate considered. Units: Kelvin. |
required |
pressure
|
Union[float, ndarray]
|
Pressure level in Pa, temperature corresponds to.
If all |
required |
Returns:
Type | Description |
---|---|
ndarray
|
Clausius clapeyron factor, \(\alpha\). Units: Kelvin\(^{-1}\) |
Source code in isca_tools/utils/moist_physics.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|
get_density(temp, pressure, sphum=None)
Equation for density using ideal gas equation of state: \(\rho = \frac{p}{RT}\). If specific humidity given, will compute density using virtual temperature, \(T_v\).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
temp
|
Union[float, ndarray]
|
|
required |
pressure
|
Union[float, ndarray]
|
|
required |
sphum
|
Optional[Union[float, ndarray]]
|
|
None
|
Returns:
Type | Description |
---|---|
Union[float, ndarray]
|
Density in units of \(kg/m^3\). |
Source code in isca_tools/utils/moist_physics.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
|
mixing_ratio_from_partial_pressure(partial_pressure, total_pressure)
Computes the mixing ratio, \(w\), from partial pressure, \(e\), and total atmospheric pressure, \(p\), according to:
\(w = \epsilon \frac{e}{p-e}\)
Where \(\epsilon = R_d/R_v = 0.622\) is the ratio of molecular weight of water to that of dry air.
This is the same equation used by MetPy.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
partial_pressure
|
Union[float, ndarray]
|
|
required |
total_pressure
|
Union[float, ndarray]
|
|
required |
Returns:
Type | Description |
---|---|
Union[float, ndarray]
|
Mixing ratio, \(w\), in units of \(kg/kg\). |
Source code in isca_tools/utils/moist_physics.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
mixing_ratio_from_sphum(sphum)
Computes the mixing ratio, \(w\), from specific humidity, \(q\), according to:
\(w = q/(1-q)\)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sphum
|
Union[float, ndarray]
|
Specific humidity, \(q\), in units of \(kg/kg\). |
required |
Returns:
Type | Description |
---|---|
Union[float, ndarray]
|
Mixing ratio, \(w\), in units of \(kg/kg\). |
Source code in isca_tools/utils/moist_physics.py
50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
moist_static_energy(temp, sphum, height, c_p_const=c_p)
Returns the moist static energy in units of kJ/kg.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
temp
|
Union[ndarray, float]
|
|
required |
sphum
|
Union[ndarray, float]
|
|
required |
height
|
Union[ndarray, float]
|
|
required |
c_p_const
|
float
|
Heat capacity constant in units of J/K/kg.
This gives the option to easily modify the moist static energy but almost always be kept at default |
c_p
|
Returns:
Type | Description |
---|---|
Union[ndarray, float]
|
Moist static energy at each coordinate given. |
Source code in isca_tools/utils/moist_physics.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
partial_pressure_from_sphum(sphum, total_pressure)
Computes the partial pressure, \(e\), from specific humidity, \(q\), and total atmospheric pressure, \(p\), according to:
\(e = wp / (\epsilon+w)\)
where \(w\) is the mixing ratio, calculated using mixing_ratio_from_sphum
, and
\(\epsilon = R_d/R_v = 0.622\) is the ratio of molecular weight of water to that of dry air.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sphum
|
Union[float, ndarray]
|
Specific humidity, \(q\), in units of \(kg/kg\). |
required |
total_pressure
|
Union[float, ndarray]
|
|
required |
Returns:
Name | Type | Description |
---|---|---|
partial_pressure |
Union[float, ndarray]
|
|
Source code in isca_tools/utils/moist_physics.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
rh_from_sphum(sphum, temp, total_pressure)
Relative humidity, \(rh\), is computed from specific humidity, \(q\) according to:
\(rh = e / e_s\)
Where, \(e = pw/(\epsilon + w)\), is the partial pressure, \(e_s\) is the saturation partial pressure and \(w\) is the mixing ratio.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sphum
|
Union[float, ndarray]
|
|
required |
temp
|
Union[float, ndarray]
|
|
required |
total_pressure
|
Union[float, ndarray]
|
|
required |
Returns:
Type | Description |
---|---|
Union[float, ndarray]
|
Percentage relative humidity (\(0 < rh < 100\)). |
Source code in isca_tools/utils/moist_physics.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
saturation_vapor_pressure(temp)
Computes the saturation vapor pressure, \(e_s(T)\), corresponding to a given temperature.
Uses Equation 10 in Bolton 1980. Valid for \(-35^\circ C < T < 35^\circ C\).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
temp
|
Union[float, ndarray]
|
Temperature to compute vapor pressure at. Units: Kelvin. |
required |
Returns:
Type | Description |
---|---|
Union[float, ndarray]
|
Saturation vapor pressure, \(e_s(T)\), in units of Pa. |
Source code in isca_tools/utils/moist_physics.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
sphum_from_dew(temp_dew, pressure)
Calculates specific humidity from dew temperature at a given pressure
.
The dew temperature is defined such as the temperature at which the saturation vapour pressure
is equal to the partial pressure i.e. \(e_s(T_d) = e(T)\) where \(T_d\) is the dew temperature, and
\(T\) is the actual temperature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
temp_dew
|
Union[float, ndarray]
|
|
required |
pressure
|
Union[float, ndarray]
|
|
required |
Returns:
Name | Type | Description |
---|---|---|
specific_humidity |
Union[float, ndarray]
|
|
Source code in isca_tools/utils/moist_physics.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
sphum_from_partial_pressure(partial_pressure, total_pressure)
Computes the specific humidity, \(q\), from partial pressure, \(e\), and total atmospheric pressure, \(p\), according to:
\(q = w / (1+w)\)
where \(w\) is the mixing ratio, calculated using mixing_ratio_from_partial_pressure
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
partial_pressure
|
Union[float, ndarray]
|
|
required |
total_pressure
|
Union[float, ndarray]
|
|
required |
Returns:
Type | Description |
---|---|
Union[float, ndarray]
|
Specific humidity, \(q\), in units of \(kg/kg\). |
Source code in isca_tools/utils/moist_physics.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
sphum_sat(temp, pressure)
Returns the saturation specific humidity, \(q^*\), in kg/kg.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
temp
|
Union[float, ndarray]
|
Temperature at each coordinate considered. Units: Kelvin. |
required |
pressure
|
Union[float, ndarray]
|
Pressure level in Pa, temperature corresponds to.
If all |
required |
Returns:
Type | Description |
---|---|
Union[float, ndarray]
|
Saturation specific humidity at each coordinate given. |
Source code in isca_tools/utils/moist_physics.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
virtual_temp(temp, sphum)
Equation for virtual temperature using Isca code.
The constants d622
, d378
, d608
are to match the
Isca code.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
temp
|
Union[float, ndarray]
|
|
required |
sphum
|
Union[float, ndarray]
|
|
required |
Returns:
Type | Description |
---|---|
Union[float, ndarray]
|
Virtual temperature at each pressure level in K. |
Source code in isca_tools/utils/moist_physics.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|