Lapse Integration (Simple)
fitting_2_layer(temp_env_lev, p_lev, temp_env_lower, p_lower, rh_lower, temp_env_upper, p_upper, temp_env_upper2, p_upper2, method_layer1='const', method_layer2='const', const_layer1_method='bulk', mod_parcel_method='add', force_parcel=False, n_lev_above_upper2_integral=0, temp_surf_lcl_calc=300, sanity_check=False, p_range_calc=2000)
Applies const_lapse_fitting or mod_parcel_lapse_fitting to each layer.
Different from lapse_integral.py in that it computes parcel temp, \(T_p(p)\) by equating \(MSE(T_{p,s}, r_s, p_s)\) rather than \(MSE^*(T_{LCL})\) to \(MSE^*(T_p(p))\). Where \(T_{p,s}\) is the parcel temperature at the surface starting from environmental LCL temperature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
temp_env_lev
|
Union[DataArray, ndarray]
|
|
required |
p_lev
|
Union[DataArray, ndarray]
|
|
required |
temp_env_lower
|
float
|
Environmental temperature at lower pressure level (nearer surface) |
required |
p_lower
|
float
|
Pressure level to start profile (near surface). |
required |
rh_lower
|
float
|
Environmental relative humidity at |
required |
temp_env_upper
|
float
|
Environmental temperature at the upper pressure level of the first layer (layer closest to surface) |
required |
p_upper
|
float
|
Pressure level to end profile of first layer (layer closest to surface). |
required |
temp_env_upper2
|
float
|
Environmental temperature at the upper pressure level of the second layer (layer furthest from surface) |
required |
p_upper2
|
float
|
Pressure level to end profile of second layer (layer furthest from surface). |
required |
method_layer1
|
Literal['const']
|
Which fitting method to use for layer 1. Not required if |
'const'
|
method_layer2
|
Literal['const', 'mod_parcel']
|
Which fitting method to use for layer 2. Not required if |
'const'
|
const_layer1_method
|
Literal['bulk', 'optimal']
|
If 'bulk', will compute lapse rate which intersects exactly with
|
'bulk'
|
mod_parcel_method
|
Literal['add', 'multiply']
|
Recommend |
'add'
|
force_parcel
|
bool
|
If |
False
|
n_lev_above_upper2_integral
|
int
|
Will return |
0
|
temp_surf_lcl_calc
|
float
|
Surface temperature to use when computing \(\sigma_{LCL}\). |
300
|
sanity_check
|
bool
|
If |
False
|
p_range_calc
|
float
|
Only compute integral if |
2000
|
Returns:
| Name | Type | Description |
|---|---|---|
lapse |
ndarray
|
Lapse rate info for each layer. Bulk lapse rate if |
integral |
ndarray
|
Result of integral \(\int_{p_1}^{p_2} \Gamma_{env}(p) d\ln p\) of each layer. Units are K/km. |
integral_error |
ndarray
|
Result of integral \(\int_{p_1}^{p_2} |\Gamma_{env}(p) - \Gamma_{approx}| d\ln p\) of each layer. Units are K/km. |
Source code in isca_tools/thesis/lapse_integral_simple.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
get_lnb_ind(temp_env_lev, p_lev, rh_surf, lapse_mod_D=0, p_surf=None, temp_surf=None, temp_surf_lcl_calc=300)
Returns a proxy for the LNB (level of neutral buoyancy): the index closest to space where
T_parcel - T_env is positive i.e. buoyant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
temp_env_lev
|
ndarray
|
|
required |
p_lev
|
ndarray
|
|
required |
rh_surf
|
float
|
Relative humidity at |
required |
lapse_mod_D
|
float
|
The parameter, such that boundary layer lapse rate equals |
0
|
p_surf
|
Optional[float]
|
Surface pressure used to calculate LCL. Units: Pa. If not provided, will set to model level closest to the surface. |
None
|
temp_surf
|
Optional[float]
|
Temperature at |
None
|
temp_surf_lcl_calc
|
Surface temperature to use when computing \(\sigma_{LCL}\). |
300
|
Returns:
| Type | Description |
|---|---|
int
|
Index of model level closest to the top of the atmosphere for which parcel temperature is warmer than environmental |
int
|
temperature. I.e. index of the buoyant layer furthest from the surface. |
int
|
If no buoyant layer, it will return the index of surface. |
int
|
Will be -1 if could not be computed. |
Source code in isca_tools/thesis/lapse_integral_simple.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | |
mod_parcel_lapse_fitting(temp_env_lev, p_lev, temp_env_lower, p_lower, temp_env_upper, p_upper, temp_parcel_lower, rh_parcel_surf, p_surf, n_lev_above_upper_integral=0, temp_surf_lcl_calc=300, sanity_check=False, method='add')
Find the constant, \(\eta\) that needs adding to parcel lapse rate such that \(\int_{p_1}^{p_2} \Gamma_{env}(p) d\ln p = \int_{p_1}^{p_2} \Gamma_p(p, T_p(p)) + \eta d\ln p\). Then computes the error in this approximation: \(\int_{p_1}^{p_2} |\Gamma_{env}(p) - \Gamma_p(p, T_p(p)) - \eta| d\ln p\).
where \(\Gamma_p(p, T)\) is the parcel (moist adiabatic) lapse rate and \(T_p(p)\) is the parcel temperature at pressure \(p\) starting at \(p_1\).
Different from lapse_integral.py in that it computes parcel temp, \(T_p(p)\) by equating \(MSE(T_{p,s}, r_s, p_s)\) rather than \(MSE^*(T_{LCL})\) to \(MSE^*(T_p(p))\). Where \(T_{p,s}\) is the parcel temperature at the surface starting from environmental LCL temperature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
temp_env_lev
|
ndarray
|
|
required |
p_lev
|
ndarray
|
|
required |
temp_env_lower
|
float
|
Environmental temperature at lower pressure level (nearer surface) |
required |
p_lower
|
float
|
Pressure level to start profile (near surface). |
required |
temp_env_upper
|
float
|
Environmental temperature at upper pressure level (further from surface) |
required |
p_upper
|
float
|
Pressure level to end profile (further from surface). |
required |
temp_parcel_lower
|
Optional[float]
|
Temperature of the parcel at |
required |
rh_parcel_surf
|
float
|
Relative humidity of the parcel at |
required |
p_surf
|
float
|
Pressure at |
required |
n_lev_above_upper_integral
|
int
|
Will return |
0
|
temp_surf_lcl_calc
|
float
|
Surface temperature to use when computing \(\sigma_{LCL}\). |
300
|
sanity_check
|
bool
|
If |
False
|
method
|
Literal['add', 'multiply']
|
Recommend |
'add'
|
Returns:
| Name | Type | Description |
|---|---|---|
lapse_diff_const |
float
|
Lapse rate adjustment, \(\eta\) which needs to be added to \(\Gamma_{p}(p, T_p(p))\) so integral matches that of environmental lapse rate. Units are K/km. |
integral |
float
|
Result of integral \(\int_{p_1}^{p_2} \Gamma_{env}(p) d\ln p\). Units are K/km. |
integral_error |
float
|
Result of integral \(\int_{p_1}^{p_2} |\Gamma_{env}(p) - \Gamma_p(p) - \eta| d\ln p\). Units are K/km. |
Source code in isca_tools/thesis/lapse_integral_simple.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
parcel_fitting(temp_env_lev, p_lev, temp_env_lower, p_lower, rh_lower, temp_env_upper, p_upper, temp_env_upper2, p_upper2, n_lev_above_upper2_integral=0, temp_surf_lcl_calc=300, return_temp_parcel_lev=False)
If follow parcel rising from the surface, this returns the error and integral value, of this profile relative to the environmental profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
temp_env_lev
|
ndarray
|
|
required |
p_lev
|
ndarray
|
Surface pressure |
required |
temp_env_lower
|
float
|
|
required |
p_lower
|
float
|
|
required |
rh_lower
|
float
|
|
required |
temp_env_upper
|
float
|
|
required |
p_upper
|
float
|
LCL pressure |
required |
temp_env_upper2
|
float
|
|
required |
p_upper2
|
float
|
FT pressure |
required |
n_lev_above_upper2_integral
|
int
|
|
0
|
temp_surf_lcl_calc
|
float
|
|
300
|
Returns:
| Name | Type | Description |
|---|---|---|
lapse |
|
|
integral |
Result of integral \(\int_{p_1}^{p_2} \Gamma_{env}(p) d\ln p\) of each layer. Units are K/km. |
|
integral_error |
Result of integral \(\int_{p_1}^{p_2} |\Gamma_{env}(p) - \Gamma_{approx}| d\ln p\) of each layer. Units are K/km. |
Source code in isca_tools/thesis/lapse_integral_simple.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |