pycontrails 0.50.2__cp310-cp310-macosx_11_0_arm64.whl → 0.51.0__cp310-cp310-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/datalib.py +22 -0
- pycontrails/core/flight.py +43 -1
- pycontrails/core/met.py +33 -5
- pycontrails/core/polygon.py +10 -3
- pycontrails/core/rgi_cython.cpython-310-darwin.so +0 -0
- pycontrails/datalib/ecmwf/__init__.py +6 -0
- pycontrails/datalib/ecmwf/arco_era5.py +2 -53
- pycontrails/datalib/ecmwf/common.py +4 -0
- pycontrails/datalib/ecmwf/era5.py +2 -6
- pycontrails/datalib/ecmwf/era5_model_level.py +481 -0
- pycontrails/datalib/ecmwf/hres_model_level.py +494 -0
- pycontrails/datalib/ecmwf/model_levels.py +79 -0
- pycontrails/datalib/ecmwf/static/model_level_dataframe_v20240418.csv +139 -0
- pycontrails/datalib/ecmwf/variables.py +12 -0
- pycontrails/models/humidity_scaling/humidity_scaling.py +55 -8
- pycontrails/models/humidity_scaling/quantiles/era5-model-level-quantiles.pq +0 -0
- pycontrails/physics/thermo.py +1 -1
- pycontrails/utils/types.py +3 -2
- {pycontrails-0.50.2.dist-info → pycontrails-0.51.0.dist-info}/METADATA +4 -4
- {pycontrails-0.50.2.dist-info → pycontrails-0.51.0.dist-info}/RECORD +26 -21
- /pycontrails/models/humidity_scaling/quantiles/{era5-quantiles.pq → era5-pressure-level-quantiles.pq} +0 -0
- {pycontrails-0.50.2.dist-info → pycontrails-0.51.0.dist-info}/LICENSE +0 -0
- {pycontrails-0.50.2.dist-info → pycontrails-0.51.0.dist-info}/NOTICE +0 -0
- {pycontrails-0.50.2.dist-info → pycontrails-0.51.0.dist-info}/WHEEL +0 -0
- {pycontrails-0.50.2.dist-info → pycontrails-0.51.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
n,a [Pa],b,ph [hPa],pf [hPa],Geopotential Altitude [m],Geometric Altitude [m],Temperature [K],Density [kg/m^3]
|
|
2
|
+
0,0.0,0.0,0.0,,,,,
|
|
3
|
+
1,2.000365,0.0,0.02,0.01,79301.79,80301.65,198.05,1.8e-05
|
|
4
|
+
2,3.102241,0.0,0.031,0.0255,73721.58,74584.91,209.21,4.2e-05
|
|
5
|
+
3,4.666084,0.0,0.0467,0.0388,71115.75,71918.79,214.42,6.3e-05
|
|
6
|
+
4,6.827977,0.0,0.0683,0.0575,68618.43,69365.77,221.32,9e-05
|
|
7
|
+
5,9.746966,0.0,0.0975,0.0829,66210.99,66906.53,228.06,0.000127
|
|
8
|
+
6,13.605424,0.0,0.1361,0.1168,63890.03,64537.43,234.56,0.000173
|
|
9
|
+
7,18.608931,0.0,0.1861,0.1611,61651.77,62254.39,240.83,0.000233
|
|
10
|
+
8,24.985718,0.0,0.2499,0.218,59492.5,60053.46,246.87,0.000308
|
|
11
|
+
9,32.98571,0.0,0.3299,0.2899,57408.61,57930.78,252.71,0.0004
|
|
12
|
+
10,42.879242,0.0,0.4288,0.3793,55396.62,55882.68,258.34,0.000512
|
|
13
|
+
11,54.955463,0.0,0.5496,0.4892,53453.2,53905.62,263.78,0.000646
|
|
14
|
+
12,69.520576,0.0,0.6952,0.6224,51575.15,51996.21,269.04,0.000806
|
|
15
|
+
13,86.895882,0.0,0.869,0.7821,49767.41,50159.36,270.65,0.001007
|
|
16
|
+
14,107.415741,0.0,1.0742,0.9716,48048.7,48413.94,270.65,0.001251
|
|
17
|
+
15,131.425507,0.0,1.3143,1.1942,46416.22,46756.98,269.02,0.001546
|
|
18
|
+
16,159.279404,0.0,1.5928,1.4535,44881.17,45199.69,264.72,0.001913
|
|
19
|
+
17,191.338562,0.0,1.9134,1.7531,43440.23,43738.55,260.68,0.002343
|
|
20
|
+
18,227.968948,0.0,2.2797,2.0965,42085.0,42364.93,256.89,0.002843
|
|
21
|
+
19,269.539581,0.0,2.6954,2.4875,40808.05,41071.2,253.31,0.003421
|
|
22
|
+
20,316.420746,0.0,3.1642,2.9298,39602.76,39850.56,249.94,0.004084
|
|
23
|
+
21,368.982361,0.0,3.6898,3.427,38463.25,38696.94,246.75,0.004838
|
|
24
|
+
22,427.592499,0.0,4.2759,3.9829,37384.22,37604.95,243.73,0.005693
|
|
25
|
+
23,492.616028,0.0,4.9262,4.601,36360.94,36569.72,240.86,0.006655
|
|
26
|
+
24,564.413452,0.0,5.6441,5.2851,35389.15,35586.89,238.14,0.007731
|
|
27
|
+
25,643.339905,0.0,6.4334,6.0388,34465.0,34652.52,235.55,0.008931
|
|
28
|
+
26,729.744141,0.0,7.2974,6.8654,33585.02,33763.05,233.09,0.010261
|
|
29
|
+
27,823.967834,0.0,8.2397,7.7686,32746.04,32915.27,230.74,0.011729
|
|
30
|
+
28,926.34491,0.0,9.2634,8.7516,31945.53,32106.57,228.6,0.013337
|
|
31
|
+
29,1037.201172,0.0,10.372,9.8177,31177.59,31330.96,227.83,0.015012
|
|
32
|
+
30,1156.853638,0.0,11.5685,10.9703,30438.54,30584.71,227.09,0.016829
|
|
33
|
+
31,1285.610352,0.0,12.8561,12.2123,29726.69,29866.09,226.38,0.018793
|
|
34
|
+
32,1423.770142,0.0,14.2377,13.5469,29040.48,29173.5,225.69,0.02091
|
|
35
|
+
33,1571.622925,0.0,15.7162,14.977,28378.46,28505.47,225.03,0.023186
|
|
36
|
+
34,1729.448975,0.0,17.2945,16.5054,27739.29,27860.64,224.39,0.025624
|
|
37
|
+
35,1897.519287,0.0,18.9752,18.1348,27121.74,27237.73,223.77,0.028232
|
|
38
|
+
36,2076.095947,0.0,20.761,19.8681,26524.63,26635.56,223.17,0.031013
|
|
39
|
+
37,2265.431641,0.0,22.6543,21.7076,25946.9,26053.04,222.6,0.033972
|
|
40
|
+
38,2465.770508,0.0,24.6577,23.656,25387.55,25489.15,222.04,0.037115
|
|
41
|
+
39,2677.348145,0.0,26.7735,25.7156,24845.63,24942.93,221.5,0.040445
|
|
42
|
+
40,2900.391357,0.0,29.0039,27.8887,24320.28,24413.5,220.97,0.043967
|
|
43
|
+
41,3135.119385,0.0,31.3512,30.1776,23810.67,23900.02,220.46,0.047685
|
|
44
|
+
42,3381.743652,0.0,33.8174,32.5843,23316.04,23401.71,219.97,0.051604
|
|
45
|
+
43,3640.468262,0.0,36.4047,35.1111,22835.68,22917.85,219.49,0.055727
|
|
46
|
+
44,3911.490479,0.0,39.1149,37.7598,22368.91,22447.75,219.02,0.060059
|
|
47
|
+
45,4194.930664,0.0,41.9493,40.5321,21915.16,21990.82,218.57,0.064602
|
|
48
|
+
46,4490.817383,0.0,44.9082,43.4287,21473.98,21546.62,218.12,0.069359
|
|
49
|
+
47,4799.149414,0.0,47.9915,46.4498,21045.0,21114.77,217.7,0.07433
|
|
50
|
+
48,5119.89502,0.0,51.199,49.5952,20627.87,20694.9,217.28,0.079516
|
|
51
|
+
49,5452.990723,0.0,54.5299,52.8644,20222.24,20286.66,216.87,0.084916
|
|
52
|
+
50,5798.344727,0.0,57.9834,56.2567,19827.95,19889.88,216.65,0.090458
|
|
53
|
+
51,6156.074219,0.0,61.5607,59.7721,19443.55,19503.09,216.65,0.09611
|
|
54
|
+
52,6526.946777,0.0,65.2695,63.4151,19068.35,19125.61,216.65,0.101968
|
|
55
|
+
53,6911.870605,0.0,69.1187,67.1941,18701.27,18756.34,216.65,0.108045
|
|
56
|
+
54,7311.869141,0.0,73.1187,71.1187,18341.27,18394.25,216.65,0.114355
|
|
57
|
+
55,7727.412109,7e-06,77.281,75.1999,17987.41,18038.35,216.65,0.120917
|
|
58
|
+
56,8159.354004,2.4e-05,81.6182,79.4496,17638.78,17687.77,216.65,0.127751
|
|
59
|
+
57,8608.525391,5.9e-05,86.145,83.8816,17294.53,17341.62,216.65,0.134877
|
|
60
|
+
58,9076.400391,0.000112,90.8774,88.5112,16953.83,16999.08,216.65,0.142321
|
|
61
|
+
59,9562.682617,0.000199,95.828,93.3527,16616.09,16659.55,216.65,0.150106
|
|
62
|
+
60,10065.978516,0.00034,101.0047,98.4164,16281.1,16322.83,216.65,0.158248
|
|
63
|
+
61,10584.631836,0.000562,106.4153,103.71,15948.85,15988.88,216.65,0.16676
|
|
64
|
+
62,11116.662109,0.00089,112.0681,109.2417,15619.3,15657.7,216.65,0.175655
|
|
65
|
+
63,11660.067383,0.001353,117.9714,115.0198,15292.44,15329.24,216.65,0.184946
|
|
66
|
+
64,12211.547852,0.001992,124.1337,121.0526,14968.24,15003.5,216.65,0.194646
|
|
67
|
+
65,12766.873047,0.002857,130.5637,127.3487,14646.68,14680.44,216.65,0.20477
|
|
68
|
+
66,13324.668945,0.003971,137.2703,133.917,14327.75,14360.05,216.65,0.215331
|
|
69
|
+
67,13881.331055,0.005378,144.2624,140.7663,14011.41,14042.3,216.65,0.226345
|
|
70
|
+
68,14432.139648,0.007133,151.5493,147.9058,13697.65,13727.18,216.65,0.237825
|
|
71
|
+
69,14975.615234,0.009261,159.1403,155.3448,13386.45,13414.65,216.65,0.249786
|
|
72
|
+
70,15508.256836,0.011806,167.045,163.0927,13077.79,13104.7,216.65,0.262244
|
|
73
|
+
71,16026.115234,0.014816,175.2731,171.1591,12771.64,12797.3,216.65,0.275215
|
|
74
|
+
72,16527.322266,0.018318,183.8344,179.5537,12467.99,12492.44,216.65,0.288713
|
|
75
|
+
73,17008.789063,0.022355,192.7389,188.2867,12166.81,12190.1,216.65,0.302755
|
|
76
|
+
74,17467.613281,0.026964,201.9969,197.3679,11868.08,11890.24,216.65,0.317357
|
|
77
|
+
75,17901.621094,0.032176,211.6186,206.8078,11571.79,11592.86,216.65,0.332536
|
|
78
|
+
76,18308.433594,0.038026,221.6146,216.6166,11277.92,11297.93,216.65,0.348308
|
|
79
|
+
77,18685.71875,0.044548,231.9954,226.805,10986.7,11005.69,216.74,0.364545
|
|
80
|
+
78,19031.289063,0.051773,242.7719,237.3837,10696.22,10714.22,218.62,0.378253
|
|
81
|
+
79,19343.511719,0.059728,253.9549,248.3634,10405.61,10422.64,220.51,0.392358
|
|
82
|
+
80,19620.042969,0.068448,265.5556,259.7553,10114.89,10130.98,222.4,0.406868
|
|
83
|
+
81,19859.390625,0.077958,277.5852,271.5704,9824.08,9839.26,224.29,0.42179
|
|
84
|
+
82,20059.931641,0.088286,290.0548,283.82,9533.2,9547.49,226.18,0.43713
|
|
85
|
+
83,20219.664063,0.099462,302.9762,296.5155,9242.26,9255.7,228.08,0.452897
|
|
86
|
+
84,20337.863281,0.111505,316.3607,309.6684,8951.3,8963.9,229.97,0.469097
|
|
87
|
+
85,20412.308594,0.124448,330.2202,323.2904,8660.32,8672.11,231.86,0.485737
|
|
88
|
+
86,20442.078125,0.138313,344.5663,337.3932,8369.35,8380.36,233.75,0.502825
|
|
89
|
+
87,20425.71875,0.153125,359.4111,351.9887,8078.41,8088.67,235.64,0.520367
|
|
90
|
+
88,20361.816406,0.16891,374.7666,367.0889,7787.51,7797.04,237.53,0.53837
|
|
91
|
+
89,20249.511719,0.185689,390.645,382.7058,7496.68,7505.51,239.42,0.556842
|
|
92
|
+
90,20087.085938,0.203491,407.0583,398.8516,7205.93,7214.09,241.31,0.57579
|
|
93
|
+
91,19874.025391,0.222333,424.019,415.5387,6915.29,6922.8,243.2,0.595219
|
|
94
|
+
92,19608.572266,0.242244,441.5395,432.7792,6624.76,6631.66,245.09,0.615138
|
|
95
|
+
93,19290.226563,0.263242,459.6321,450.5858,6334.38,6340.68,246.98,0.635553
|
|
96
|
+
94,18917.460938,0.285354,478.3096,468.9708,6044.15,6049.89,248.86,0.656471
|
|
97
|
+
95,18489.707031,0.308598,497.5845,487.947,5754.1,5759.3,250.75,0.677899
|
|
98
|
+
96,18006.925781,0.332939,517.4198,507.5021,5464.6,5469.3,252.63,0.699815
|
|
99
|
+
97,17471.839844,0.358254,537.7195,527.5696,5176.77,5180.98,254.5,0.722139
|
|
100
|
+
98,16888.6875,0.384363,558.343,548.0312,4892.26,4896.02,256.35,0.744735
|
|
101
|
+
99,16262.046875,0.411125,579.1926,568.7678,4612.58,4615.92,258.17,0.767472
|
|
102
|
+
100,15596.695313,0.438391,600.1668,589.6797,4338.77,4341.73,259.95,0.790242
|
|
103
|
+
101,14898.453125,0.466003,621.1624,610.6646,4071.8,4074.41,261.68,0.812937
|
|
104
|
+
102,14173.324219,0.4938,642.0764,631.6194,3812.53,3814.82,263.37,0.835453
|
|
105
|
+
103,13427.769531,0.521619,662.8084,652.4424,3561.7,3563.69,265.0,0.857686
|
|
106
|
+
104,12668.257813,0.549301,683.262,673.0352,3319.94,3321.67,266.57,0.879541
|
|
107
|
+
105,11901.339844,0.576692,703.3467,693.3043,3087.75,3089.25,268.08,0.900929
|
|
108
|
+
106,11133.304688,0.603648,722.9795,713.1631,2865.54,2866.83,269.52,0.921768
|
|
109
|
+
107,10370.175781,0.630036,742.0855,732.5325,2653.58,2654.69,270.9,0.941988
|
|
110
|
+
108,9617.515625,0.655736,760.5996,751.3426,2452.04,2452.99,272.21,0.961527
|
|
111
|
+
109,8880.453125,0.680643,778.4661,769.5329,2260.99,2261.8,273.45,0.980334
|
|
112
|
+
110,8163.375,0.704669,795.6396,787.0528,2080.41,2081.09,274.63,0.998368
|
|
113
|
+
111,7470.34375,0.727739,812.0847,803.8622,1910.19,1910.76,275.73,1.015598
|
|
114
|
+
112,6804.421875,0.749797,827.7756,819.9302,1750.14,1750.63,276.77,1.032005
|
|
115
|
+
113,6168.53125,0.770798,842.6959,835.2358,1600.04,1600.44,277.75,1.047576
|
|
116
|
+
114,5564.382813,0.790717,856.8376,849.7668,1459.58,1459.91,278.66,1.06231
|
|
117
|
+
115,4993.796875,0.809536,870.2004,863.519,1328.43,1328.7,279.52,1.076209
|
|
118
|
+
116,4457.375,0.827256,882.791,876.4957,1206.21,1206.44,280.31,1.089286
|
|
119
|
+
117,3955.960938,0.843881,894.6222,888.7066,1092.54,1092.73,281.05,1.101558
|
|
120
|
+
118,3489.234375,0.859432,905.7116,900.1669,987.0,987.15,281.73,1.113047
|
|
121
|
+
119,3057.265625,0.873929,916.0815,910.8965,889.17,889.29,282.37,1.123777
|
|
122
|
+
120,2659.140625,0.887408,925.7571,920.9193,798.62,798.72,282.96,1.133779
|
|
123
|
+
121,2294.242188,0.8999,934.7666,930.2618,714.94,715.02,283.5,1.143084
|
|
124
|
+
122,1961.5,0.911448,943.1399,938.9532,637.7,637.76,284.0,1.151724
|
|
125
|
+
123,1659.476563,0.922096,950.9082,947.024,566.49,566.54,284.47,1.159733
|
|
126
|
+
124,1387.546875,0.931881,958.1037,954.5059,500.91,500.95,284.89,1.167147
|
|
127
|
+
125,1143.25,0.94086,964.7584,961.4311,440.58,440.61,285.29,1.173999
|
|
128
|
+
126,926.507813,0.949064,970.9046,967.8315,385.14,385.16,285.65,1.180323
|
|
129
|
+
127,734.992188,0.95655,976.5737,973.7392,334.22,334.24,285.98,1.186154
|
|
130
|
+
128,568.0625,0.963352,981.7968,979.1852,287.51,287.52,286.28,1.191523
|
|
131
|
+
129,424.414063,0.969513,986.6036,984.2002,244.68,244.69,286.56,1.196462
|
|
132
|
+
130,302.476563,0.975078,991.023,988.8133,205.44,205.44,286.81,1.201001
|
|
133
|
+
131,202.484375,0.980072,995.0824,993.0527,169.5,169.51,287.05,1.205168
|
|
134
|
+
132,122.101563,0.984542,998.8081,996.9452,136.62,136.62,287.26,1.208992
|
|
135
|
+
133,62.78125,0.9885,1002.225,1000.5165,106.54,106.54,287.46,1.212498
|
|
136
|
+
134,22.835938,0.991984,1005.3562,1003.7906,79.04,79.04,287.64,1.21571
|
|
137
|
+
135,3.757813,0.995003,1008.2239,1006.79,53.92,53.92,287.8,1.21865
|
|
138
|
+
136,0.0,0.99763,1010.8487,1009.5363,30.96,30.96,287.95,1.221341
|
|
139
|
+
137,0.0,1.0,1013.25,1012.0494,10.0,10.0,288.09,1.223803
|
|
@@ -240,5 +240,17 @@ SURFACE_VARIABLES = [
|
|
|
240
240
|
CloudAreaFraction,
|
|
241
241
|
SurfaceSolarDownwardRadiation,
|
|
242
242
|
]
|
|
243
|
+
MODEL_LEVEL_VARIABLES = [
|
|
244
|
+
met_var.AirTemperature,
|
|
245
|
+
met_var.SpecificHumidity,
|
|
246
|
+
met_var.VerticalVelocity,
|
|
247
|
+
met_var.EastwardWind,
|
|
248
|
+
met_var.NorthwardWind,
|
|
249
|
+
RelativeVorticity,
|
|
250
|
+
Divergence,
|
|
251
|
+
CloudAreaFractionInLayer,
|
|
252
|
+
SpecificCloudIceWaterContent,
|
|
253
|
+
SpecificCloudLiquidWaterContent,
|
|
254
|
+
]
|
|
243
255
|
|
|
244
256
|
ECMWF_VARIABLES = PRESSURE_LEVEL_VARIABLES + SURFACE_VARIABLES
|
|
@@ -591,9 +591,15 @@ class HumidityScalingByLevel(HumidityScaling):
|
|
|
591
591
|
|
|
592
592
|
|
|
593
593
|
@functools.cache
|
|
594
|
-
def _load_quantiles() -> pd.DataFrame:
|
|
594
|
+
def _load_quantiles(level_type: str) -> pd.DataFrame:
|
|
595
595
|
"""Load precomputed ERA5 and IAGOS quantiles.
|
|
596
596
|
|
|
597
|
+
Parameters
|
|
598
|
+
----------
|
|
599
|
+
level_type : {"pressure", "model"}
|
|
600
|
+
Select whether to load precomputed quantiles from pressure- vs
|
|
601
|
+
model-level ERA5 data.
|
|
602
|
+
|
|
597
603
|
Returns
|
|
598
604
|
-------
|
|
599
605
|
pd.DataFrame
|
|
@@ -602,17 +608,20 @@ def _load_quantiles() -> pd.DataFrame:
|
|
|
602
608
|
and the interpolation methodology. The IAOGS quantiles are in the
|
|
603
609
|
``("iagos", "iagos")`` column.
|
|
604
610
|
"""
|
|
605
|
-
path = pathlib.Path(__file__).parent / "quantiles" / "era5-quantiles.pq"
|
|
606
|
-
|
|
611
|
+
path = pathlib.Path(__file__).parent / "quantiles" / f"era5-{level_type}-level-quantiles.pq"
|
|
612
|
+
df = pd.read_parquet(path)
|
|
613
|
+
df.attrs["path"] = str(path)
|
|
614
|
+
return df
|
|
607
615
|
|
|
608
616
|
|
|
609
617
|
def histogram_matching(
|
|
610
618
|
era5_rhi: ArrayLike,
|
|
611
619
|
product_type: str,
|
|
620
|
+
level_type: str,
|
|
612
621
|
member: int | None,
|
|
613
622
|
q_method: str | None,
|
|
614
623
|
) -> npt.NDArray[np.float64]:
|
|
615
|
-
"""Map ERA5-derived RHi to
|
|
624
|
+
"""Map ERA5-derived RHi to its corresponding IAGOS quantile via histogram matching.
|
|
616
625
|
|
|
617
626
|
This matching is performed on a **single** ERA5 ensemble member.
|
|
618
627
|
|
|
@@ -622,6 +631,11 @@ def histogram_matching(
|
|
|
622
631
|
ERA5-derived RHi values for the given ensemble member.
|
|
623
632
|
product_type : {"reanalysis", "ensemble_members"}
|
|
624
633
|
The ERA5 product type.
|
|
634
|
+
level_type : {"pressure", "model"}
|
|
635
|
+
Select whether to perform quantile mapping based on quantiles from
|
|
636
|
+
pressure- or model-level ERA5 data. Selecting ``level_type == "model"``
|
|
637
|
+
when ``product_type == "ensemble_members"`` will produce a warning
|
|
638
|
+
and change ``product_type`` to ``"reanalysis"``.
|
|
625
639
|
member : int | None
|
|
626
640
|
The ERA5 ensemble member to use. Must be in the range ``[0, 10)``.
|
|
627
641
|
Only used if ``product_type == "ensemble_members"``.
|
|
@@ -634,18 +648,30 @@ def histogram_matching(
|
|
|
634
648
|
The IAGOS quantiles corresponding to the ERA5-derived RHi values. Returned
|
|
635
649
|
as a numpy array with the same shape and dtype as ``era5_rhi``.
|
|
636
650
|
"""
|
|
637
|
-
|
|
651
|
+
if level_type not in ["pressure", "model"]:
|
|
652
|
+
msg = f"Invalid 'level_type' value '{level_type}'. " "Must be one of ['pressure', 'model']."
|
|
653
|
+
raise ValueError(msg)
|
|
654
|
+
df = _load_quantiles(level_type)
|
|
638
655
|
iagos_quantiles = df[("iagos", "iagos")]
|
|
639
656
|
|
|
657
|
+
if product_type == "ensemble_members" and level_type == "model":
|
|
658
|
+
msg = (
|
|
659
|
+
"No quantiles available for model-level ensemble data. "
|
|
660
|
+
"Switching to product_type = 'reanalysis'."
|
|
661
|
+
)
|
|
662
|
+
warnings.warn(msg)
|
|
663
|
+
product_type = "reanalysis"
|
|
664
|
+
|
|
640
665
|
if product_type == "ensemble_members":
|
|
641
666
|
col = f"ensemble{member}", q_method or "linear-q"
|
|
642
667
|
elif product_type == "reanalysis":
|
|
643
668
|
col = "reanalysis", q_method or "linear-q"
|
|
644
669
|
else:
|
|
645
|
-
|
|
670
|
+
msg = (
|
|
646
671
|
f"Invalid 'product_type' value '{product_type}'. "
|
|
647
672
|
"Must be one of ['reanalysis', 'ensemble_members']."
|
|
648
673
|
)
|
|
674
|
+
raise ValueError(msg)
|
|
649
675
|
|
|
650
676
|
try:
|
|
651
677
|
era5_quantiles = df[col]
|
|
@@ -691,7 +717,7 @@ def histogram_matching_all_members(
|
|
|
691
717
|
|
|
692
718
|
# Perform histogram matching on the given ensemble member
|
|
693
719
|
ensemble_member_rhi = histogram_matching(
|
|
694
|
-
era5_rhi_all_members[:, member], "ensemble_members", member, q_method
|
|
720
|
+
era5_rhi_all_members[:, member], "ensemble_members", "pressure", member, q_method
|
|
695
721
|
)
|
|
696
722
|
|
|
697
723
|
# Perform histogram matching on all other ensemble members
|
|
@@ -702,7 +728,7 @@ def histogram_matching_all_members(
|
|
|
702
728
|
ensemble_mean_rhi += ensemble_member_rhi
|
|
703
729
|
else:
|
|
704
730
|
ensemble_mean_rhi += histogram_matching(
|
|
705
|
-
era5_rhi_all_members[:, r], "ensemble_members", r, q_method
|
|
731
|
+
era5_rhi_all_members[:, r], "ensemble_members", "pressure", r, q_method
|
|
706
732
|
)
|
|
707
733
|
|
|
708
734
|
# Divide by the number of ensemble members to get the mean
|
|
@@ -766,6 +792,9 @@ class HistogramMatchingParams(models.ModelParams):
|
|
|
766
792
|
#: The ERA5 product. Must be one of ``"reanalysis"`` or ``"ensemble_members"``.
|
|
767
793
|
product_type: str = "reanalysis"
|
|
768
794
|
|
|
795
|
+
#: The ERA5 vertical level type. Must be one of ``"pressure"`` or ``"model"``.
|
|
796
|
+
level_type: str = "pressure"
|
|
797
|
+
|
|
769
798
|
#: The ERA5 ensemble member to use. Must be in the range ``[0, 10)``.
|
|
770
799
|
#: Only used if ``product_type`` is ``"ensemble_members"``.
|
|
771
800
|
member: int | None = None
|
|
@@ -779,6 +808,23 @@ class HistogramMatching(HumidityScaling):
|
|
|
779
808
|
formula = "era5_quantiles -> iagos_quantiles"
|
|
780
809
|
default_params = HistogramMatchingParams
|
|
781
810
|
|
|
811
|
+
def __init__(
|
|
812
|
+
self,
|
|
813
|
+
met: MetDataset | None = None,
|
|
814
|
+
params: dict[str, Any] | None = None,
|
|
815
|
+
**params_kwargs: Any,
|
|
816
|
+
):
|
|
817
|
+
if (params is None or "level_type" not in params) and (
|
|
818
|
+
params_kwargs is None or "level_type" not in params_kwargs
|
|
819
|
+
):
|
|
820
|
+
msg = (
|
|
821
|
+
"The default level_type will change from 'pressure' to 'model' "
|
|
822
|
+
"in a future release. To silence this warning, "
|
|
823
|
+
"provide a 'level_type' value when instantiating HistogramMatching."
|
|
824
|
+
)
|
|
825
|
+
warnings.warn(msg, DeprecationWarning)
|
|
826
|
+
super().__init__(met, params, **params_kwargs)
|
|
827
|
+
|
|
782
828
|
@overrides
|
|
783
829
|
def scale(
|
|
784
830
|
self,
|
|
@@ -793,6 +839,7 @@ class HistogramMatching(HumidityScaling):
|
|
|
793
839
|
rhi_1 = histogram_matching(
|
|
794
840
|
rhi,
|
|
795
841
|
self.params["product_type"],
|
|
842
|
+
self.params["level_type"],
|
|
796
843
|
self.params["member"],
|
|
797
844
|
self.params["interpolation_q_method"],
|
|
798
845
|
)
|
pycontrails/physics/thermo.py
CHANGED
|
@@ -66,7 +66,7 @@ def c_pm(q: ArrayScalarLike) -> ArrayScalarLike:
|
|
|
66
66
|
Some models (including CoCiP) use a constant value here (1004 :math:`J \ kg^{-1} \ K^{-1}`)
|
|
67
67
|
|
|
68
68
|
"""
|
|
69
|
-
return constants.c_pd * (1.0 +
|
|
69
|
+
return constants.c_pd * (1.0 - q) + constants.c_pv * q
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
def p_vapor(q: ArrayScalarLike, p: ArrayScalarLike) -> ArrayScalarLike:
|
pycontrails/utils/types.py
CHANGED
|
@@ -58,7 +58,6 @@ def support_arraylike(
|
|
|
58
58
|
- `numpy ufuncs <https://numpy.org/doc/stable/reference/ufuncs.html>`_
|
|
59
59
|
"""
|
|
60
60
|
|
|
61
|
-
@functools.wraps(func)
|
|
62
61
|
def wrapped(arr: ArrayScalarLike) -> ArrayScalarLike:
|
|
63
62
|
x = np.asarray(arr)
|
|
64
63
|
|
|
@@ -86,7 +85,9 @@ def support_arraylike(
|
|
|
86
85
|
# Pass numpy `ret` through for anything else
|
|
87
86
|
return ret
|
|
88
87
|
|
|
89
|
-
|
|
88
|
+
# this line produces a mypy error starting on mypy version 1.1.0,
|
|
89
|
+
# likely due to changes in https://github.com/python/mypy/pull/16942
|
|
90
|
+
return functools.update_wrapper(wrapped, func) # type: ignore
|
|
90
91
|
|
|
91
92
|
|
|
92
93
|
def apply_nan_mask_to_arraylike(arr: ArrayLike, nan_mask: np.ndarray) -> ArrayLike:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pycontrails
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.51.0
|
|
4
4
|
Summary: Python library for modeling aviation climate impacts
|
|
5
5
|
Author-email: Breakthrough Energy <py@contrails.org>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -36,7 +36,7 @@ Requires-Dist: xarray >=2022.3
|
|
|
36
36
|
Provides-Extra: complete
|
|
37
37
|
Requires-Dist: pycontrails[ecmwf,gcp,gfs,goes,jupyter,pyproj,vis,zarr] ; extra == 'complete'
|
|
38
38
|
Provides-Extra: dev
|
|
39
|
-
Requires-Dist: black[jupyter] ==24.
|
|
39
|
+
Requires-Dist: black[jupyter] ==24.4.1 ; extra == 'dev'
|
|
40
40
|
Requires-Dist: dep-license ; extra == 'dev'
|
|
41
41
|
Requires-Dist: fastparquet >=0.8 ; extra == 'dev'
|
|
42
42
|
Requires-Dist: ipdb >=0.13 ; extra == 'dev'
|
|
@@ -47,10 +47,10 @@ Requires-Dist: platformdirs >=3.0 ; extra == 'dev'
|
|
|
47
47
|
Requires-Dist: pre-commit >=2.10 ; extra == 'dev'
|
|
48
48
|
Requires-Dist: psutil ; extra == 'dev'
|
|
49
49
|
Requires-Dist: pyarrow >=5.0 ; extra == 'dev'
|
|
50
|
-
Requires-Dist: pytest >=8.
|
|
50
|
+
Requires-Dist: pytest >=8.2 ; extra == 'dev'
|
|
51
51
|
Requires-Dist: pytest-cov >=2.11 ; extra == 'dev'
|
|
52
52
|
Requires-Dist: requests >=2.25 ; extra == 'dev'
|
|
53
|
-
Requires-Dist: ruff ==0.1
|
|
53
|
+
Requires-Dist: ruff ==0.4.1 ; extra == 'dev'
|
|
54
54
|
Provides-Extra: docs
|
|
55
55
|
Requires-Dist: doc8 >=1.1 ; extra == 'docs'
|
|
56
56
|
Requires-Dist: furo >=2023.3 ; extra == 'docs'
|
|
@@ -1,38 +1,42 @@
|
|
|
1
|
-
pycontrails-0.
|
|
2
|
-
pycontrails-0.
|
|
3
|
-
pycontrails-0.
|
|
4
|
-
pycontrails-0.
|
|
5
|
-
pycontrails-0.
|
|
6
|
-
pycontrails-0.
|
|
7
|
-
pycontrails/_version.py,sha256=
|
|
1
|
+
pycontrails-0.51.0.dist-info/RECORD,,
|
|
2
|
+
pycontrails-0.51.0.dist-info/LICENSE,sha256=gJ-h7SFFD1mCfR6a7HILvEtodDT6Iig8bLXdgqR6ucA,10175
|
|
3
|
+
pycontrails-0.51.0.dist-info/WHEEL,sha256=E2L8cNry8_qENFWMb8KxRWLe-RhZW94hLc32Xo3HiTg,110
|
|
4
|
+
pycontrails-0.51.0.dist-info/NOTICE,sha256=gKI8DcN1WhiXB2SFRKDogcjONldGubTvBxiOYdC4CXU,1926
|
|
5
|
+
pycontrails-0.51.0.dist-info/top_level.txt,sha256=Z8J1R_AiBAyCVjNw6jYLdrA68PrQqTg0t3_Yek_IZ0Q,29
|
|
6
|
+
pycontrails-0.51.0.dist-info/METADATA,sha256=ffNiyz3UxTW2Snj6wwHdKIse5R-GTWYebWi6Gx3ZJ3Y,8366
|
|
7
|
+
pycontrails/_version.py,sha256=PduUz-IZe7h3dOvDzyQFqtIuB8bpKtQaiE1lK2u0IVU,413
|
|
8
8
|
pycontrails/__init__.py,sha256=c_Vtz7CvdiVAL8ggluash9-8tGcLO_5Vvu-3_Ie47CE,1985
|
|
9
9
|
pycontrails/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
pycontrails/core/vector.py,sha256=P61Rv1M040A1SRHmdWVR_RfXcWa6faM330n-9499ilI,71722
|
|
11
11
|
pycontrails/core/models.py,sha256=sipUAH_r0A1TxQ0yBjaPj8WC33Piw34ABHyrmRePfhg,39003
|
|
12
12
|
pycontrails/core/interpolation.py,sha256=FFYdUnTzGnkjoGs-FKsK3Y3nSK5lQI-mpq5HPALZ-y4,25495
|
|
13
13
|
pycontrails/core/fleet.py,sha256=84oTb8RJ3-bPVvZn3O2ljMEZLwJ9Q-E455ZzQJ4QaQU,16075
|
|
14
|
-
pycontrails/core/rgi_cython.cpython-310-darwin.so,sha256=
|
|
15
|
-
pycontrails/core/flight.py,sha256=
|
|
14
|
+
pycontrails/core/rgi_cython.cpython-310-darwin.so,sha256=V3XQo-A_3-EEtvmT9HKTormhbBOrsuKMJ_S397oOUas,310656
|
|
15
|
+
pycontrails/core/flight.py,sha256=tkR7p8ry5Gxd6Das-84Ny3ClXApwbcVFiqkfihy63T4,81467
|
|
16
16
|
pycontrails/core/fuel.py,sha256=kJZ3P1lPm1L6rdPREM55XQ-VfJ_pt35cP4sO2Nnvmjs,4332
|
|
17
|
-
pycontrails/core/polygon.py,sha256=
|
|
18
|
-
pycontrails/core/datalib.py,sha256=
|
|
17
|
+
pycontrails/core/polygon.py,sha256=bLddqnsaA7XVXFcEVXR3V1tVIu5qQ8sxPUjFbwt0lO8,17993
|
|
18
|
+
pycontrails/core/datalib.py,sha256=m39gKxdhy9KSBhwWlrzEc5z-tTqPfcs7bPcqSxbU0k0,23971
|
|
19
19
|
pycontrails/core/cache.py,sha256=rCBZiRSVoFkRwf_ay7O-eba2PaYoXdlJSz1znZPuOQk,27957
|
|
20
20
|
pycontrails/core/__init__.py,sha256=4ZE7x1gMa_Q7GcgcWpPP9fQ-sTulCXWmMjsCJ0odakY,840
|
|
21
21
|
pycontrails/core/flightplan.py,sha256=s7tHbjMFbHAJkSWV6hPkghuW6jDb1n5UhWAo9XbJ9z0,7349
|
|
22
|
-
pycontrails/core/met.py,sha256=
|
|
22
|
+
pycontrails/core/met.py,sha256=HORTWNre9rSyOgNnVnVaW0A6jDjU5W5A5s2L89KIZyM,93602
|
|
23
23
|
pycontrails/core/aircraft_performance.py,sha256=4yNGfArt741HNFjxpWvEu86BTzie9LaPjC4KH3dXYts,21966
|
|
24
24
|
pycontrails/core/airports.py,sha256=aeyAXVkioIRomrP79UtNrxindL4f1DJyXFaojZCuBBw,6758
|
|
25
25
|
pycontrails/core/met_var.py,sha256=EhrLGdrCAp8cKb-3Whd_ttLMZn4_zLMhE-QyFinESqo,9197
|
|
26
26
|
pycontrails/core/coordinates.py,sha256=vVITA90x0Jx-UQG2XMm3JAKKsIrFUcU861xV-L9czTI,5291
|
|
27
27
|
pycontrails/datalib/goes.py,sha256=Myz53yENqopOOsVT7K-M16SLvoBPPnOg-14fq6DvzdQ,26359
|
|
28
28
|
pycontrails/datalib/__init__.py,sha256=s5b8W6scXgespKZjPcaC-8jyLd3FqZqN0BZccLxaGuE,237
|
|
29
|
-
pycontrails/datalib/ecmwf/arco_era5.py,sha256=
|
|
30
|
-
pycontrails/datalib/ecmwf/era5.py,sha256=
|
|
29
|
+
pycontrails/datalib/ecmwf/arco_era5.py,sha256=6UCy75rPTJZokzQK6jccxLy6nOPBbAP8Z-6QbN_eMsY,18568
|
|
30
|
+
pycontrails/datalib/ecmwf/era5.py,sha256=_TV0g24HVmU93fNO8ykvhWaaHSwnc2QT3cFHhhmsSjU,18178
|
|
31
|
+
pycontrails/datalib/ecmwf/era5_model_level.py,sha256=R_Z30DvJU7i7_sPgYV5GDhHBPIKd2ChoePYfWP0rTYw,18881
|
|
31
32
|
pycontrails/datalib/ecmwf/hres.py,sha256=yJapluaSaOrHw23iUc-OIIW2Jd7iVLlDcvMSQpd7ToU,28172
|
|
32
|
-
pycontrails/datalib/ecmwf/variables.py,sha256=
|
|
33
|
-
pycontrails/datalib/ecmwf/
|
|
34
|
-
pycontrails/datalib/ecmwf/
|
|
33
|
+
pycontrails/datalib/ecmwf/variables.py,sha256=S5SV_kPrWRhwOpOYcWw3V5VRUB_HOVCTw3Sf7UClJEk,9605
|
|
34
|
+
pycontrails/datalib/ecmwf/hres_model_level.py,sha256=CBrtZnX9Hbu1xBk8ALypLDUycg_7o30wJS-G3VELo2Q,19065
|
|
35
|
+
pycontrails/datalib/ecmwf/__init__.py,sha256=kwgk9P4RYdLgOYcBLXX5rWz1T_yL7aO8nt2Eb1PB-eE,1455
|
|
36
|
+
pycontrails/datalib/ecmwf/common.py,sha256=veOzDmAjLJcfSRQrQNl4hz8g4rusOEl8Ph9GBwoQOok,3832
|
|
37
|
+
pycontrails/datalib/ecmwf/model_levels.py,sha256=x83WJtjC6OnHcUsiNgvYIrVX4lY-pkXR-YlvUo9vYis,2712
|
|
35
38
|
pycontrails/datalib/ecmwf/ifs.py,sha256=s__NOQcUfbvxVPyCE7qgO8cxYLJoh7PWj7zZS-nKR7g,10594
|
|
39
|
+
pycontrails/datalib/ecmwf/static/model_level_dataframe_v20240418.csv,sha256=PmvGLRzn6uuCKSwiasSuVcehvvmSaqP7cnLuN6hhCQQ,9788
|
|
36
40
|
pycontrails/datalib/gfs/gfs.py,sha256=wOvOl1d-7B024uaaak9gnXg99Lbnv7yhE00ajSGRw6U,21569
|
|
37
41
|
pycontrails/datalib/gfs/variables.py,sha256=KESzB1sTD3hsU8T-qZFD29oFM3l2ZcEtjAE_H7BHKIE,2861
|
|
38
42
|
pycontrails/datalib/gfs/__init__.py,sha256=tWxgqmlW8Uo07J-3fBTXPrteatzTka9mSXomhWy3NVA,684
|
|
@@ -44,7 +48,7 @@ pycontrails/ext/empirical_grid.py,sha256=WSC266aKsQLzCmtrZJCpLdDBykZ9rlFE9xEXmZj
|
|
|
44
48
|
pycontrails/ext/bada.py,sha256=j4Tj7oWSV_6UxYYa9_OjC1yTVzJMQdNRDI4aUQam_xM,1063
|
|
45
49
|
pycontrails/utils/iteration.py,sha256=q_vb39VjxRr4hqTyPYko3gK4sboJOJf_Evq6m_2DL-g,319
|
|
46
50
|
pycontrails/utils/__init__.py,sha256=Gt_57sBgfliFSxx9sDpuchykFDxmM11Wg9xAeSqPcnI,32
|
|
47
|
-
pycontrails/utils/types.py,sha256=
|
|
51
|
+
pycontrails/utils/types.py,sha256=skrZuOB1yQivtg7rUi8bZwBzOD9ZINu93Cx0NaLzCkw,4773
|
|
48
52
|
pycontrails/utils/temp.py,sha256=lGU0b_R8ze4yKlsOusHIIBaoNFBrmrB3vBjgHRlfcXk,1109
|
|
49
53
|
pycontrails/utils/json.py,sha256=4PL7xkt-O9VGvngHh8F1nfbSbgoxjNlDZDUQRxYfcCM,5982
|
|
50
54
|
pycontrails/utils/dependencies.py,sha256=ATP45xYdUbIyGFzgbOe5SbokMytvB84TcexUEFnEUZE,2559
|
|
@@ -63,9 +67,10 @@ pycontrails/models/emissions/black_carbon.py,sha256=F2SCUiV39zg2mUxbWsct6vvr_JgH
|
|
|
63
67
|
pycontrails/models/emissions/static/edb-nvpm-v29b-engines.csv,sha256=NatpVI1D2tTDLK7uVvlanm9DhfFB44nmFA4aocUcXco,77318
|
|
64
68
|
pycontrails/models/emissions/static/edb-gaseous-v29b-engines.csv,sha256=Oub-FkyR4cPlTEPo9wDPAn4i4CpGpKH2tet30MNitI0,127518
|
|
65
69
|
pycontrails/models/emissions/static/default-engine-uids.csv,sha256=3blb0aqtM8YRsyT1WDo0UYTBtv1h4BwXRIC_Ll9fhnI,6217
|
|
66
|
-
pycontrails/models/humidity_scaling/humidity_scaling.py,sha256=
|
|
70
|
+
pycontrails/models/humidity_scaling/humidity_scaling.py,sha256=9619kSgNIBjkM8vFWcwny7t4mhg00pX0aKabrDGPn7I,36658
|
|
67
71
|
pycontrails/models/humidity_scaling/__init__.py,sha256=nqsab_j9BCwMbTfCn4BjXMdhItlvNKkgUJ9-lb8RyIo,1119
|
|
68
|
-
pycontrails/models/humidity_scaling/quantiles/era5-quantiles.pq,sha256=tfYhbafF9Z-gGCg6VQ1YBlOaK_01e65Dc6s9b-hQ6Zo,286375
|
|
72
|
+
pycontrails/models/humidity_scaling/quantiles/era5-pressure-level-quantiles.pq,sha256=tfYhbafF9Z-gGCg6VQ1YBlOaK_01e65Dc6s9b-hQ6Zo,286375
|
|
73
|
+
pycontrails/models/humidity_scaling/quantiles/era5-model-level-quantiles.pq,sha256=pShCvNUo0NYtAHhT9IBRuj38X9jejdlKfv-ZoOKmtKI,35943
|
|
69
74
|
pycontrails/models/cocip/radiative_forcing.py,sha256=ERuFcYMo0_1iiOricnZ8D4ext23bMnTCeZwg9vd6Vzs,44944
|
|
70
75
|
pycontrails/models/cocip/wind_shear.py,sha256=p8d3iaNzxPA3MoxFEM1ZDKt0aticoD6U9cv0QmbuBzs,3860
|
|
71
76
|
pycontrails/models/cocip/cocip.py,sha256=0ILMcjbgsM00rCXAeo9UkSnUsmvq1XvORhNPI-ReNcM,97591
|
|
@@ -90,5 +95,5 @@ pycontrails/physics/geo.py,sha256=lqEpTLhex2r-o-6EHSSEiPC8xqZ-NlwwCBob9-cJA_w,30
|
|
|
90
95
|
pycontrails/physics/units.py,sha256=j-G5AC9eWIvv2MTOq9lUOoOQKFNJJuHzWLanHRji2tE,12272
|
|
91
96
|
pycontrails/physics/constants.py,sha256=pHQQmccMUwuNnY4hFtm3L8G2rnUQcfJnroyQr8HAVeM,3146
|
|
92
97
|
pycontrails/physics/__init__.py,sha256=_1eWbEy6evEWdfJCEkwDiSdpiDNzNWEPVqaPekHyhwU,44
|
|
93
|
-
pycontrails/physics/thermo.py,sha256=
|
|
98
|
+
pycontrails/physics/thermo.py,sha256=UA7jLApcbu53fo1ACtgF578Np17efn0UN1yxwus4gEQ,12789
|
|
94
99
|
pycontrails/physics/jet.py,sha256=JX-o5dDjyITMNUIOcD_7UBt_4ldc9v-5gI6bmwf0wQ4,25624
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|