pycontrails 0.42.0__cp311-cp311-macosx_11_0_arm64.whl → 0.42.2__cp311-cp311-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pycontrails might be problematic. Click here for more details.
- pycontrails/_version.py +2 -2
- pycontrails/core/cache.py +4 -6
- pycontrails/core/datalib.py +5 -2
- pycontrails/core/fleet.py +59 -7
- pycontrails/core/flight.py +175 -49
- pycontrails/core/flightplan.py +238 -0
- pycontrails/core/interpolation.py +11 -15
- pycontrails/core/met.py +5 -5
- pycontrails/core/models.py +4 -0
- pycontrails/core/rgi_cython.cpython-311-darwin.so +0 -0
- pycontrails/core/vector.py +17 -12
- pycontrails/datalib/ecmwf/common.py +14 -19
- pycontrails/ext/bada/__init__.py +6 -6
- pycontrails/ext/cirium/__init__.py +2 -2
- pycontrails/models/cocip/cocip.py +37 -39
- pycontrails/models/cocip/cocip_params.py +37 -30
- pycontrails/models/cocip/cocip_uncertainty.py +47 -58
- pycontrails/models/cocip/radiative_forcing.py +220 -193
- pycontrails/models/cocip/wake_vortex.py +96 -91
- pycontrails/models/humidity_scaling.py +265 -8
- pycontrails/models/issr.py +1 -1
- pycontrails/models/quantiles/era5_ensemble_quantiles.npy +0 -0
- pycontrails/models/quantiles/iagos_quantiles.npy +0 -0
- pycontrails/models/sac.py +2 -0
- pycontrails/physics/geo.py +2 -1
- pycontrails/utils/json.py +3 -3
- {pycontrails-0.42.0.dist-info → pycontrails-0.42.2.dist-info}/METADATA +4 -7
- {pycontrails-0.42.0.dist-info → pycontrails-0.42.2.dist-info}/RECORD +32 -29
- {pycontrails-0.42.0.dist-info → pycontrails-0.42.2.dist-info}/LICENSE +0 -0
- {pycontrails-0.42.0.dist-info → pycontrails-0.42.2.dist-info}/NOTICE +0 -0
- {pycontrails-0.42.0.dist-info → pycontrails-0.42.2.dist-info}/WHEEL +0 -0
- {pycontrails-0.42.0.dist-info → pycontrails-0.42.2.dist-info}/top_level.txt +0 -0
|
@@ -3,47 +3,48 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import numpy as np
|
|
6
|
+
import numpy.typing as npt
|
|
6
7
|
|
|
7
8
|
from pycontrails.models.cocip import wind_shear
|
|
8
9
|
from pycontrails.physics import constants, thermo
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
def max_downward_displacement(
|
|
12
|
-
wingspan: np.
|
|
13
|
-
true_airspeed: np.
|
|
14
|
-
aircraft_mass: np.
|
|
15
|
-
air_temperature: np.
|
|
16
|
-
dT_dz: np.
|
|
17
|
-
ds_dz: np.
|
|
18
|
-
air_pressure: np.
|
|
13
|
+
wingspan: npt.NDArray[np.float_] | float,
|
|
14
|
+
true_airspeed: npt.NDArray[np.float_],
|
|
15
|
+
aircraft_mass: npt.NDArray[np.float_] | float,
|
|
16
|
+
air_temperature: npt.NDArray[np.float_],
|
|
17
|
+
dT_dz: npt.NDArray[np.float_],
|
|
18
|
+
ds_dz: npt.NDArray[np.float_],
|
|
19
|
+
air_pressure: npt.NDArray[np.float_],
|
|
19
20
|
effective_vertical_resolution: float,
|
|
20
|
-
wind_shear_enhancement_exponent: float | np.
|
|
21
|
-
) -> np.
|
|
21
|
+
wind_shear_enhancement_exponent: float | npt.NDArray[np.float_],
|
|
22
|
+
) -> npt.NDArray[np.float_]:
|
|
22
23
|
"""
|
|
23
24
|
Calculate the maximum contrail downward displacement after the wake vortex phase.
|
|
24
25
|
|
|
25
26
|
Parameters
|
|
26
27
|
----------
|
|
27
|
-
wingspan : np.
|
|
28
|
+
wingspan : npt.NDArray[np.float_] | float
|
|
28
29
|
aircraft wingspan, [:math:`m`]
|
|
29
|
-
true_airspeed : np.
|
|
30
|
+
true_airspeed : npt.NDArray[np.float_]
|
|
30
31
|
true airspeed for each waypoint, [:math:`m s^{-1}`]
|
|
31
|
-
aircraft_mass : np.
|
|
32
|
+
aircraft_mass : npt.NDArray[np.float_] | float
|
|
32
33
|
aircraft mass for each waypoint, [:math:`kg`]
|
|
33
|
-
air_temperature : np.
|
|
34
|
+
air_temperature : npt.NDArray[np.float_]
|
|
34
35
|
ambient temperature for each waypoint, [:math:`K`]
|
|
35
|
-
dT_dz : np.
|
|
36
|
+
dT_dz : npt.NDArray[np.float_]
|
|
36
37
|
potential temperature gradient, [:math:`K m^{-1}`]
|
|
37
|
-
ds_dz : np.
|
|
38
|
+
ds_dz : npt.NDArray[np.float_]
|
|
38
39
|
Difference in wind speed over dz in the atmosphere, [:math:`m s^{-1} / m`]
|
|
39
|
-
air_pressure : np.
|
|
40
|
+
air_pressure : npt.NDArray[np.float_]
|
|
40
41
|
pressure altitude at each waypoint, [:math:`Pa`]
|
|
41
42
|
effective_vertical_resolution, wind_shear_enhancement_exponent: float
|
|
42
43
|
Passed through to :func:`wind_shear.wind_shear_enhancement_factor`
|
|
43
44
|
|
|
44
45
|
Returns
|
|
45
46
|
-------
|
|
46
|
-
np.
|
|
47
|
+
npt.NDArray[np.float_]
|
|
47
48
|
Max contrail downward displacement after the wake vortex phase, [:math:`m`]
|
|
48
49
|
|
|
49
50
|
References
|
|
@@ -81,28 +82,28 @@ def max_downward_displacement(
|
|
|
81
82
|
|
|
82
83
|
|
|
83
84
|
def get_effective_time_scale(
|
|
84
|
-
wingspan: np.
|
|
85
|
-
true_airspeed: np.
|
|
86
|
-
aircraft_mass: np.
|
|
87
|
-
rho_air: np.
|
|
88
|
-
) -> np.
|
|
85
|
+
wingspan: npt.NDArray[np.float_] | float,
|
|
86
|
+
true_airspeed: npt.NDArray[np.float_],
|
|
87
|
+
aircraft_mass: npt.NDArray[np.float_] | float,
|
|
88
|
+
rho_air: npt.NDArray[np.float_],
|
|
89
|
+
) -> npt.NDArray[np.float_]:
|
|
89
90
|
r"""
|
|
90
91
|
Calculate the effective time scale of the wake vortex.
|
|
91
92
|
|
|
92
93
|
Parameters
|
|
93
94
|
----------
|
|
94
|
-
wingspan : np.
|
|
95
|
+
wingspan : npt.NDArray[np.float_]
|
|
95
96
|
aircraft wingspan, [:math:`m`]
|
|
96
|
-
true_airspeed : np.
|
|
97
|
+
true_airspeed : npt.NDArray[np.float_]
|
|
97
98
|
true airspeed for each waypoint, [:math:`m \ s^{-1}`]
|
|
98
|
-
aircraft_mass : np.
|
|
99
|
+
aircraft_mass : npt.NDArray[np.float_]
|
|
99
100
|
aircraft mass for each waypoint, [:math:`kg`]
|
|
100
|
-
rho_air : np.
|
|
101
|
+
rho_air : npt.NDArray[np.float_]
|
|
101
102
|
density of air for each waypoint, [:math:`kg \ m^{-3}`]
|
|
102
103
|
|
|
103
104
|
Returns
|
|
104
105
|
-------
|
|
105
|
-
np.
|
|
106
|
+
npt.NDArray[np.float_]
|
|
106
107
|
Wake vortex effective time scale
|
|
107
108
|
|
|
108
109
|
Notes
|
|
@@ -118,31 +119,31 @@ def get_effective_time_scale(
|
|
|
118
119
|
|
|
119
120
|
|
|
120
121
|
def get_downward_displacement_strongly_stratified(
|
|
121
|
-
wingspan: np.
|
|
122
|
-
true_airspeed: np.
|
|
123
|
-
aircraft_mass: np.
|
|
124
|
-
rho_air: np.
|
|
125
|
-
n_bv: np.
|
|
126
|
-
) -> np.
|
|
122
|
+
wingspan: npt.NDArray[np.float_] | float,
|
|
123
|
+
true_airspeed: npt.NDArray[np.float_],
|
|
124
|
+
aircraft_mass: npt.NDArray[np.float_] | float,
|
|
125
|
+
rho_air: npt.NDArray[np.float_],
|
|
126
|
+
n_bv: npt.NDArray[np.float_],
|
|
127
|
+
) -> npt.NDArray[np.float_]:
|
|
127
128
|
"""
|
|
128
129
|
Calculate the maximum contrail downward displacement under strongly stratified conditions.
|
|
129
130
|
|
|
130
131
|
Parameters
|
|
131
132
|
----------
|
|
132
|
-
wingspan : np.
|
|
133
|
+
wingspan : npt.NDArray[np.float_] | float
|
|
133
134
|
aircraft wingspan, [:math:`m`]
|
|
134
|
-
true_airspeed : np.
|
|
135
|
+
true_airspeed : npt.NDArray[np.float_]
|
|
135
136
|
true airspeed for each waypoint, [:math:`m s^{-1}`]
|
|
136
|
-
aircraft_mass : np.
|
|
137
|
+
aircraft_mass : npt.NDArray[np.float_] | float
|
|
137
138
|
aircraft mass for each waypoint, [:math:`kg`]
|
|
138
|
-
rho_air : np.
|
|
139
|
+
rho_air : npt.NDArray[np.float_]
|
|
139
140
|
density of air for each waypoint, [:math:`kg m^{-3}`]
|
|
140
|
-
n_bv : np.
|
|
141
|
+
n_bv : npt.NDArray[np.float_]
|
|
141
142
|
Brunt-Vaisaila frequency, [:math:`s^{-1}`]
|
|
142
143
|
|
|
143
144
|
Returns
|
|
144
145
|
-------
|
|
145
|
-
np.
|
|
146
|
+
npt.NDArray[np.float_]
|
|
146
147
|
Maximum contrail downward displacement, strongly stratified conditions.
|
|
147
148
|
|
|
148
149
|
Notes
|
|
@@ -158,46 +159,46 @@ def get_downward_displacement_strongly_stratified(
|
|
|
158
159
|
|
|
159
160
|
|
|
160
161
|
def get_downward_displacement_weakly_stratified(
|
|
161
|
-
wingspan: np.
|
|
162
|
-
true_airspeed: np.
|
|
163
|
-
aircraft_mass: np.
|
|
164
|
-
rho_air: np.
|
|
165
|
-
n_bv: np.
|
|
166
|
-
dz_max_strong: np.
|
|
167
|
-
ds_dz: np.
|
|
168
|
-
t_0: np.
|
|
162
|
+
wingspan: npt.NDArray[np.float_] | float,
|
|
163
|
+
true_airspeed: npt.NDArray[np.float_],
|
|
164
|
+
aircraft_mass: npt.NDArray[np.float_] | float,
|
|
165
|
+
rho_air: npt.NDArray[np.float_],
|
|
166
|
+
n_bv: npt.NDArray[np.float_],
|
|
167
|
+
dz_max_strong: npt.NDArray[np.float_],
|
|
168
|
+
ds_dz: npt.NDArray[np.float_],
|
|
169
|
+
t_0: npt.NDArray[np.float_],
|
|
169
170
|
effective_vertical_resolution: float,
|
|
170
|
-
wind_shear_enhancement_exponent: np.
|
|
171
|
-
) -> np.
|
|
171
|
+
wind_shear_enhancement_exponent: npt.NDArray[np.float_] | float,
|
|
172
|
+
) -> npt.NDArray[np.float_]:
|
|
172
173
|
"""
|
|
173
174
|
Calculate the maximum contrail downward displacement under weakly/stably stratified conditions.
|
|
174
175
|
|
|
175
176
|
Parameters
|
|
176
177
|
----------
|
|
177
|
-
wingspan : np.
|
|
178
|
+
wingspan : npt.NDArray[np.float_] | float
|
|
178
179
|
aircraft wingspan, [:math:`m`]
|
|
179
|
-
true_airspeed : np.
|
|
180
|
+
true_airspeed : npt.NDArray[np.float_]
|
|
180
181
|
true airspeed for each waypoint, [:math:`m s^{-1}`]
|
|
181
|
-
aircraft_mass : np.
|
|
182
|
+
aircraft_mass : npt.NDArray[np.float_] | float
|
|
182
183
|
aircraft mass for each waypoint, [:math:`kg`]
|
|
183
|
-
rho_air : np.
|
|
184
|
+
rho_air : npt.NDArray[np.float_]
|
|
184
185
|
density of air for each waypoint, [:math:`kg m^{-3}`]
|
|
185
|
-
n_bv : np.
|
|
186
|
+
n_bv : npt.NDArray[np.float_]
|
|
186
187
|
Brunt-Vaisaila frequency, [:math:`s^{-1}`]
|
|
187
|
-
dz_max_strong : np.
|
|
188
|
+
dz_max_strong : npt.NDArray[np.float_]
|
|
188
189
|
Max contrail downward displacement under strongly stratified conditions, [:math:`m`]
|
|
189
|
-
ds_dz : np.
|
|
190
|
+
ds_dz : npt.NDArray[np.float_]
|
|
190
191
|
Difference in wind speed over dz in the atmosphere, [:math:`m s^{-1} / m`]
|
|
191
|
-
t_0 : np.
|
|
192
|
+
t_0 : npt.NDArray[np.float_]
|
|
192
193
|
Wake vortex effective time scale
|
|
193
194
|
effective_vertical_resolution: float
|
|
194
195
|
Passed through to :func:`wind_shear.wind_shear_enhancement_factor`
|
|
195
|
-
wind_shear_enhancement_exponent: np.
|
|
196
|
+
wind_shear_enhancement_exponent: npt.NDArray[np.float_] | float
|
|
196
197
|
Passed through to :func:`wind_shear.wind_shear_enhancement_factor`
|
|
197
198
|
|
|
198
199
|
Returns
|
|
199
200
|
-------
|
|
200
|
-
np.
|
|
201
|
+
npt.NDArray[np.float_]
|
|
201
202
|
Maximum contrail downward displacement, weakly/stably stratified conditions.
|
|
202
203
|
|
|
203
204
|
Notes
|
|
@@ -209,7 +210,7 @@ def get_downward_displacement_weakly_stratified(
|
|
|
209
210
|
- :cite:`schumannContrailCirrusPrediction2012`
|
|
210
211
|
"""
|
|
211
212
|
b_0 = get_wake_vortex_separation(wingspan)
|
|
212
|
-
dz_max = np.maximum(dz_max_strong, 10)
|
|
213
|
+
dz_max = np.maximum(dz_max_strong, 10.0)
|
|
213
214
|
shear_enhancement_factor = wind_shear.wind_shear_enhancement_factor(
|
|
214
215
|
dz_max, effective_vertical_resolution, wind_shear_enhancement_exponent
|
|
215
216
|
)
|
|
@@ -221,27 +222,29 @@ def get_downward_displacement_weakly_stratified(
|
|
|
221
222
|
return b_0 * (7.68 * (1 - 4.07 * epsn_st + 5.67 * epsn_st**2) * (0.79 - n_bv * t_0) + 1.88)
|
|
222
223
|
|
|
223
224
|
|
|
224
|
-
def get_wake_vortex_separation(
|
|
225
|
+
def get_wake_vortex_separation(
|
|
226
|
+
wingspan: npt.NDArray[np.float_] | float,
|
|
227
|
+
) -> npt.NDArray[np.float_] | float:
|
|
225
228
|
"""
|
|
226
229
|
Calculate the wake vortex separation.
|
|
227
230
|
|
|
228
231
|
Parameters
|
|
229
232
|
----------
|
|
230
|
-
wingspan : np.
|
|
233
|
+
wingspan : npt.NDArray[np.float_] | float
|
|
231
234
|
aircraft wingspan, [:math:`m`]
|
|
232
235
|
|
|
233
236
|
Returns
|
|
234
237
|
-------
|
|
235
|
-
np.
|
|
238
|
+
npt.NDArray[np.float_]
|
|
236
239
|
wake vortex separation, [:math:`m`]
|
|
237
240
|
"""
|
|
238
|
-
return (np.pi * wingspan) / 4
|
|
241
|
+
return (np.pi * wingspan) / 4.0
|
|
239
242
|
|
|
240
243
|
|
|
241
244
|
def turbulent_kinetic_energy_dissipation_rate(
|
|
242
|
-
ds_dz: np.
|
|
243
|
-
shear_enhancement_factor: np.
|
|
244
|
-
) -> np.
|
|
245
|
+
ds_dz: npt.NDArray[np.float_],
|
|
246
|
+
shear_enhancement_factor: npt.NDArray[np.float_] | float = 1.0,
|
|
247
|
+
) -> npt.NDArray[np.float_]:
|
|
245
248
|
"""
|
|
246
249
|
Calculate the turbulent kinetic energy dissipation rate (epsilon).
|
|
247
250
|
|
|
@@ -249,14 +252,14 @@ def turbulent_kinetic_energy_dissipation_rate(
|
|
|
249
252
|
|
|
250
253
|
Parameters
|
|
251
254
|
----------
|
|
252
|
-
ds_dz : np.
|
|
255
|
+
ds_dz : npt.NDArray[np.float_]
|
|
253
256
|
Difference in wind speed over dz in the atmosphere, [:math:`m s^{-1} / m`]
|
|
254
|
-
shear_enhancement_factor : np.
|
|
257
|
+
shear_enhancement_factor : npt.NDArray[np.float_] | float
|
|
255
258
|
Multiplication factor to enhance the wind shear
|
|
256
259
|
|
|
257
260
|
Returns
|
|
258
261
|
-------
|
|
259
|
-
np.
|
|
262
|
+
npt.NDArray[np.float_]
|
|
260
263
|
turbulent kinetic energy dissipation rate
|
|
261
264
|
|
|
262
265
|
Notes
|
|
@@ -271,31 +274,31 @@ def turbulent_kinetic_energy_dissipation_rate(
|
|
|
271
274
|
|
|
272
275
|
|
|
273
276
|
def normalized_dissipation_rate(
|
|
274
|
-
epsilon: np.
|
|
275
|
-
wingspan: np.
|
|
276
|
-
true_airspeed: np.
|
|
277
|
-
aircraft_mass: np.
|
|
278
|
-
rho_air: np.
|
|
279
|
-
) -> np.
|
|
277
|
+
epsilon: npt.NDArray[np.float_],
|
|
278
|
+
wingspan: npt.NDArray[np.float_] | float,
|
|
279
|
+
true_airspeed: npt.NDArray[np.float_],
|
|
280
|
+
aircraft_mass: npt.NDArray[np.float_] | float,
|
|
281
|
+
rho_air: npt.NDArray[np.float_] | float,
|
|
282
|
+
) -> npt.NDArray[np.float_]:
|
|
280
283
|
"""
|
|
281
284
|
Calculate the normalized dissipation rate of the sinking wake vortex.
|
|
282
285
|
|
|
283
286
|
Parameters
|
|
284
287
|
----------
|
|
285
|
-
epsilon: np.
|
|
288
|
+
epsilon: npt.NDArray[np.float_]
|
|
286
289
|
turbulent kinetic energy dissipation rate
|
|
287
|
-
wingspan : np.
|
|
290
|
+
wingspan : npt.NDArray[np.float_] | float
|
|
288
291
|
aircraft wingspan, [:math:`m`]
|
|
289
|
-
true_airspeed : np.
|
|
292
|
+
true_airspeed : npt.NDArray[np.float_]
|
|
290
293
|
true airspeed for each waypoint, [:math:`m s^{-1}`]
|
|
291
|
-
aircraft_mass : np.
|
|
294
|
+
aircraft_mass : npt.NDArray[np.float_]
|
|
292
295
|
aircraft mass for each waypoint, [:math:`kg`]
|
|
293
|
-
rho_air : np.
|
|
296
|
+
rho_air : npt.NDArray[np.float_]
|
|
294
297
|
density of air for each waypoint, [:math:`kg m^{-3}`]
|
|
295
298
|
|
|
296
299
|
Returns
|
|
297
300
|
-------
|
|
298
|
-
np.
|
|
301
|
+
npt.NDArray[np.float_]
|
|
299
302
|
Normalized dissipation rate of the sinking wake vortex
|
|
300
303
|
|
|
301
304
|
Notes
|
|
@@ -320,43 +323,45 @@ def normalized_dissipation_rate(
|
|
|
320
323
|
return np.minimum(epsn_st, 0.36)
|
|
321
324
|
|
|
322
325
|
|
|
323
|
-
def initial_contrail_width(
|
|
326
|
+
def initial_contrail_width(
|
|
327
|
+
wingspan: npt.NDArray[np.float_] | float, dz_max: npt.NDArray[np.float_]
|
|
328
|
+
) -> npt.NDArray[np.float_]:
|
|
324
329
|
"""
|
|
325
330
|
Calculate the initial contrail width.
|
|
326
331
|
|
|
327
332
|
Parameters
|
|
328
333
|
----------
|
|
329
|
-
wingspan : np.
|
|
334
|
+
wingspan : npt.NDArray[np.float_] | float
|
|
330
335
|
aircraft wingspan, [:math:`m`]
|
|
331
|
-
dz_max : np.
|
|
336
|
+
dz_max : npt.NDArray[np.float_]
|
|
332
337
|
Max contrail downward displacement after the wake vortex phase, [:math:`m`]
|
|
333
338
|
Only the size of this array is used; the values are ignored.
|
|
334
339
|
|
|
335
340
|
Returns
|
|
336
341
|
-------
|
|
337
|
-
np.
|
|
342
|
+
npt.NDArray[np.float_]
|
|
338
343
|
Initial contrail width, [:math:`m`]
|
|
339
344
|
"""
|
|
340
345
|
return np.full_like(dz_max, np.pi / 4) * wingspan
|
|
341
346
|
|
|
342
347
|
|
|
343
348
|
def initial_contrail_depth(
|
|
344
|
-
dz_max: np.
|
|
345
|
-
) -> np.
|
|
349
|
+
dz_max: npt.NDArray[np.float_], initial_wake_vortex_depth: float | npt.NDArray[np.float_]
|
|
350
|
+
) -> npt.NDArray[np.float_]:
|
|
346
351
|
"""
|
|
347
352
|
Calculate the initial contrail depth.
|
|
348
353
|
|
|
349
354
|
Parameters
|
|
350
355
|
----------
|
|
351
|
-
dz_max : np.
|
|
356
|
+
dz_max : npt.NDArray[np.float_]
|
|
352
357
|
Max contrail downward displacement after the wake vortex phase, [:math:`m`]
|
|
353
|
-
initial_wake_vortex_depth : float | np.
|
|
358
|
+
initial_wake_vortex_depth : float | npt.NDArray[np.float_]
|
|
354
359
|
Initial wake vortex depth scaling factor.
|
|
355
360
|
Denoted `C_D0` in eq (14) in :cite:`schumannContrailCirrusPrediction2012`.
|
|
356
361
|
|
|
357
362
|
Returns
|
|
358
363
|
-------
|
|
359
|
-
np.
|
|
364
|
+
npt.NDArray[np.float_]
|
|
360
365
|
Initial contrail depth [m]
|
|
361
366
|
"""
|
|
362
367
|
return dz_max * initial_wake_vortex_depth
|