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', mod_parcel_method='add', 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 |
temp_parcel_lev
|
|
required | |
temp_parcel_lower
|
Parcel temperature at lower pressure level (nearer surface) |
required | |
temp_parcel_upper
|
Parcel temperature at the upper pressure level of the first layer (layer closest to surface) |
required | |
temp_parcel_upper2
|
Parcel temperature at the upper pressure level of the second layer (layer furthest from surface) |
required | |
method_layer1
|
Literal['const']
|
Which fitting method to use for layer 1. |
'const'
|
method_layer2
|
Literal['const', 'mod_parcel']
|
Which fitting method to use for layer 2. |
'const'
|
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
120 121 122 123 124 125 126 127 128 129 130 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 194 195 196 197 198 199 200 201 202 | |
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. |
Source code in isca_tools/thesis/lapse_integral_simple.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
mod_parcel_lapse_fitting(temp_env_lev, p_lev, temp_env_lower, p_lower, temp_env_upper, p_upper, temp_parcel_surf, 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_surf
|
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
|
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 | |