extremeweatherbench 1.0.0__py3-none-any.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.
- extremeweatherbench/__init__.py +339 -0
- extremeweatherbench/_cape.py +741 -0
- extremeweatherbench/calc.py +873 -0
- extremeweatherbench/cases.py +193 -0
- extremeweatherbench/data/events.yaml +4044 -0
- extremeweatherbench/data/long_events.yaml +48 -0
- extremeweatherbench/defaults.py +420 -0
- extremeweatherbench/derived.py +579 -0
- extremeweatherbench/evaluate.py +979 -0
- extremeweatherbench/evaluate_cli.py +206 -0
- extremeweatherbench/events/__init__.py +0 -0
- extremeweatherbench/events/atmospheric_river.py +216 -0
- extremeweatherbench/events/severe_convection.py +333 -0
- extremeweatherbench/events/tropical_cyclone.py +1001 -0
- extremeweatherbench/inputs.py +1332 -0
- extremeweatherbench/metrics.py +1964 -0
- extremeweatherbench/regions.py +673 -0
- extremeweatherbench/sources/__init__.py +40 -0
- extremeweatherbench/sources/base.py +67 -0
- extremeweatherbench/sources/pandas_dataframe.py +190 -0
- extremeweatherbench/sources/polars_lazyframe.py +220 -0
- extremeweatherbench/sources/xarray_dataarray.py +117 -0
- extremeweatherbench/sources/xarray_dataset.py +134 -0
- extremeweatherbench/utils.py +846 -0
- extremeweatherbench-1.0.0.dist-info/METADATA +182 -0
- extremeweatherbench-1.0.0.dist-info/RECORD +29 -0
- extremeweatherbench-1.0.0.dist-info/WHEEL +4 -0
- extremeweatherbench-1.0.0.dist-info/entry_points.txt +2 -0
- extremeweatherbench-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
"""ExtremeWeatherBench: A benchmarking framework for extreme weather forecasts.
|
|
2
|
+
|
|
3
|
+
This module provides the public API for ExtremeWeatherBench. Users can import
|
|
4
|
+
the package and access all key functionality:
|
|
5
|
+
|
|
6
|
+
import extremeweatherbench as ewb
|
|
7
|
+
|
|
8
|
+
# Main entry point for evaluation
|
|
9
|
+
ewb.evaluation(case_metadata=..., evaluation_objects=...)
|
|
10
|
+
|
|
11
|
+
# Hierarchical access via namespace submodules
|
|
12
|
+
ewb.targets.ERA5(...)
|
|
13
|
+
ewb.forecasts.ZarrForecast(...)
|
|
14
|
+
ewb.metrics.MeanAbsoluteError(...)
|
|
15
|
+
|
|
16
|
+
# Also available at top level
|
|
17
|
+
ewb.ERA5(...)
|
|
18
|
+
ewb.load_cases()
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from types import SimpleNamespace
|
|
22
|
+
|
|
23
|
+
# Import actual modules for backwards compatibility
|
|
24
|
+
from extremeweatherbench import calc, cases, defaults, derived, metrics, regions, utils
|
|
25
|
+
|
|
26
|
+
# Import specific items for top-level access
|
|
27
|
+
from extremeweatherbench.calc import (
|
|
28
|
+
convert_from_cartesian_to_latlon,
|
|
29
|
+
geopotential_thickness,
|
|
30
|
+
great_circle_mask,
|
|
31
|
+
haversine_distance,
|
|
32
|
+
maybe_calculate_wind_speed,
|
|
33
|
+
mixing_ratio,
|
|
34
|
+
orography,
|
|
35
|
+
pressure_at_surface,
|
|
36
|
+
saturation_mixing_ratio,
|
|
37
|
+
saturation_vapor_pressure,
|
|
38
|
+
specific_humidity_from_relative_humidity,
|
|
39
|
+
)
|
|
40
|
+
from extremeweatherbench.cases import (
|
|
41
|
+
CaseOperator,
|
|
42
|
+
IndividualCase,
|
|
43
|
+
build_case_operators,
|
|
44
|
+
load_ewb_events_yaml_into_case_list,
|
|
45
|
+
load_individual_cases,
|
|
46
|
+
load_individual_cases_from_yaml,
|
|
47
|
+
read_incoming_yaml,
|
|
48
|
+
)
|
|
49
|
+
from extremeweatherbench.defaults import (
|
|
50
|
+
DEFAULT_COORDINATE_VARIABLES,
|
|
51
|
+
DEFAULT_VARIABLE_NAMES,
|
|
52
|
+
cira_fcnv2_atmospheric_river_forecast,
|
|
53
|
+
cira_fcnv2_freeze_forecast,
|
|
54
|
+
cira_fcnv2_heatwave_forecast,
|
|
55
|
+
cira_fcnv2_severe_convection_forecast,
|
|
56
|
+
cira_fcnv2_tropical_cyclone_forecast,
|
|
57
|
+
era5_atmospheric_river_target,
|
|
58
|
+
era5_freeze_target,
|
|
59
|
+
era5_heatwave_target,
|
|
60
|
+
get_brightband_evaluation_objects,
|
|
61
|
+
get_climatology,
|
|
62
|
+
ghcn_freeze_target,
|
|
63
|
+
ghcn_heatwave_target,
|
|
64
|
+
ibtracs_target,
|
|
65
|
+
lsr_target,
|
|
66
|
+
pph_target,
|
|
67
|
+
)
|
|
68
|
+
from extremeweatherbench.derived import (
|
|
69
|
+
AtmosphericRiverVariables,
|
|
70
|
+
CravenBrooksSignificantSevere,
|
|
71
|
+
DerivedVariable,
|
|
72
|
+
TropicalCycloneTrackVariables,
|
|
73
|
+
maybe_derive_variables,
|
|
74
|
+
maybe_include_variables_from_derived_input,
|
|
75
|
+
)
|
|
76
|
+
from extremeweatherbench.evaluate import ExtremeWeatherBench
|
|
77
|
+
from extremeweatherbench.inputs import (
|
|
78
|
+
ARCO_ERA5_FULL_URI,
|
|
79
|
+
DEFAULT_GHCN_URI,
|
|
80
|
+
ERA5,
|
|
81
|
+
GHCN,
|
|
82
|
+
IBTRACS_URI,
|
|
83
|
+
LSR,
|
|
84
|
+
LSR_URI,
|
|
85
|
+
PPH,
|
|
86
|
+
PPH_URI,
|
|
87
|
+
CIRA_metadata_variable_mapping,
|
|
88
|
+
ERA5_metadata_variable_mapping,
|
|
89
|
+
EvaluationObject,
|
|
90
|
+
ForecastBase,
|
|
91
|
+
HRES_metadata_variable_mapping,
|
|
92
|
+
IBTrACS,
|
|
93
|
+
IBTrACS_metadata_variable_mapping,
|
|
94
|
+
InputBase,
|
|
95
|
+
KerchunkForecast,
|
|
96
|
+
TargetBase,
|
|
97
|
+
XarrayForecast,
|
|
98
|
+
ZarrForecast,
|
|
99
|
+
align_forecast_to_target,
|
|
100
|
+
check_for_missing_data,
|
|
101
|
+
maybe_subset_variables,
|
|
102
|
+
open_kerchunk_reference,
|
|
103
|
+
zarr_target_subsetter,
|
|
104
|
+
)
|
|
105
|
+
from extremeweatherbench.metrics import (
|
|
106
|
+
Accuracy,
|
|
107
|
+
BaseMetric,
|
|
108
|
+
CompositeMetric,
|
|
109
|
+
CriticalSuccessIndex,
|
|
110
|
+
DurationMeanError,
|
|
111
|
+
EarlySignal,
|
|
112
|
+
FalseAlarmRatio,
|
|
113
|
+
FalseNegatives,
|
|
114
|
+
FalsePositives,
|
|
115
|
+
LandfallDisplacement,
|
|
116
|
+
LandfallIntensityMeanAbsoluteError,
|
|
117
|
+
LandfallMetric,
|
|
118
|
+
LandfallTimeMeanError,
|
|
119
|
+
MaximumLowestMeanAbsoluteError,
|
|
120
|
+
MaximumMeanAbsoluteError,
|
|
121
|
+
MeanAbsoluteError,
|
|
122
|
+
MeanError,
|
|
123
|
+
MeanSquaredError,
|
|
124
|
+
MinimumMeanAbsoluteError,
|
|
125
|
+
RootMeanSquaredError,
|
|
126
|
+
SpatialDisplacement,
|
|
127
|
+
ThresholdMetric,
|
|
128
|
+
TrueNegatives,
|
|
129
|
+
TruePositives,
|
|
130
|
+
)
|
|
131
|
+
from extremeweatherbench.regions import (
|
|
132
|
+
REGION_TYPES,
|
|
133
|
+
BoundingBoxRegion,
|
|
134
|
+
CenteredRegion,
|
|
135
|
+
Region,
|
|
136
|
+
RegionSubsetter,
|
|
137
|
+
ShapefileRegion,
|
|
138
|
+
map_to_create_region,
|
|
139
|
+
subset_cases_to_region,
|
|
140
|
+
subset_results_to_region,
|
|
141
|
+
)
|
|
142
|
+
from extremeweatherbench.utils import (
|
|
143
|
+
check_for_vars,
|
|
144
|
+
convert_day_yearofday_to_time,
|
|
145
|
+
convert_init_time_to_valid_time,
|
|
146
|
+
convert_longitude_to_180,
|
|
147
|
+
convert_longitude_to_360,
|
|
148
|
+
convert_valid_time_to_init_time,
|
|
149
|
+
derive_indices_from_init_time_and_lead_time,
|
|
150
|
+
determine_temporal_resolution,
|
|
151
|
+
extract_tc_names,
|
|
152
|
+
filter_kwargs_for_callable,
|
|
153
|
+
find_common_init_times,
|
|
154
|
+
idx_to_coords,
|
|
155
|
+
interp_climatology_to_target,
|
|
156
|
+
is_valid_landfall,
|
|
157
|
+
load_land_geometry,
|
|
158
|
+
maybe_cache_and_compute,
|
|
159
|
+
maybe_densify_dataarray,
|
|
160
|
+
maybe_get_closest_timestamp_to_center_of_valid_times,
|
|
161
|
+
maybe_get_operator,
|
|
162
|
+
min_if_all_timesteps_present,
|
|
163
|
+
min_if_all_timesteps_present_forecast,
|
|
164
|
+
read_event_yaml,
|
|
165
|
+
remove_ocean_gridpoints,
|
|
166
|
+
stack_dataarray_from_dims,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
# Aliases
|
|
170
|
+
evaluation = ExtremeWeatherBench
|
|
171
|
+
load_cases = load_ewb_events_yaml_into_case_list
|
|
172
|
+
|
|
173
|
+
# Namespace submodules for convenient grouping (these don't shadow actual modules)
|
|
174
|
+
targets = SimpleNamespace(
|
|
175
|
+
TargetBase=TargetBase,
|
|
176
|
+
ERA5=ERA5,
|
|
177
|
+
GHCN=GHCN,
|
|
178
|
+
IBTrACS=IBTrACS,
|
|
179
|
+
LSR=LSR,
|
|
180
|
+
PPH=PPH,
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
forecasts = SimpleNamespace(
|
|
184
|
+
ForecastBase=ForecastBase,
|
|
185
|
+
ZarrForecast=ZarrForecast,
|
|
186
|
+
KerchunkForecast=KerchunkForecast,
|
|
187
|
+
XarrayForecast=XarrayForecast,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
__all__ = [
|
|
191
|
+
# Core evaluation
|
|
192
|
+
"evaluation",
|
|
193
|
+
"ExtremeWeatherBench",
|
|
194
|
+
# Modules
|
|
195
|
+
"calc",
|
|
196
|
+
"cases",
|
|
197
|
+
"defaults",
|
|
198
|
+
"derived",
|
|
199
|
+
"metrics",
|
|
200
|
+
"regions",
|
|
201
|
+
"utils",
|
|
202
|
+
# Namespace submodules
|
|
203
|
+
"targets",
|
|
204
|
+
"forecasts",
|
|
205
|
+
# Aliases
|
|
206
|
+
"load_cases",
|
|
207
|
+
# calc
|
|
208
|
+
"convert_from_cartesian_to_latlon",
|
|
209
|
+
"geopotential_thickness",
|
|
210
|
+
"great_circle_mask",
|
|
211
|
+
"haversine_distance",
|
|
212
|
+
"maybe_calculate_wind_speed",
|
|
213
|
+
"mixing_ratio",
|
|
214
|
+
"orography",
|
|
215
|
+
"pressure_at_surface",
|
|
216
|
+
"saturation_mixing_ratio",
|
|
217
|
+
"saturation_vapor_pressure",
|
|
218
|
+
"specific_humidity_from_relative_humidity",
|
|
219
|
+
# cases
|
|
220
|
+
"CaseOperator",
|
|
221
|
+
"IndividualCase",
|
|
222
|
+
"build_case_operators",
|
|
223
|
+
"load_ewb_events_yaml_into_case_list",
|
|
224
|
+
"load_individual_cases",
|
|
225
|
+
"load_individual_cases_from_yaml",
|
|
226
|
+
"read_incoming_yaml",
|
|
227
|
+
# defaults
|
|
228
|
+
"DEFAULT_COORDINATE_VARIABLES",
|
|
229
|
+
"DEFAULT_VARIABLE_NAMES",
|
|
230
|
+
"cira_fcnv2_atmospheric_river_forecast",
|
|
231
|
+
"cira_fcnv2_freeze_forecast",
|
|
232
|
+
"cira_fcnv2_heatwave_forecast",
|
|
233
|
+
"cira_fcnv2_severe_convection_forecast",
|
|
234
|
+
"cira_fcnv2_tropical_cyclone_forecast",
|
|
235
|
+
"era5_atmospheric_river_target",
|
|
236
|
+
"era5_freeze_target",
|
|
237
|
+
"era5_heatwave_target",
|
|
238
|
+
"get_brightband_evaluation_objects",
|
|
239
|
+
"get_climatology",
|
|
240
|
+
"ghcn_freeze_target",
|
|
241
|
+
"ghcn_heatwave_target",
|
|
242
|
+
"ibtracs_target",
|
|
243
|
+
"lsr_target",
|
|
244
|
+
"pph_target",
|
|
245
|
+
# derived
|
|
246
|
+
"AtmosphericRiverVariables",
|
|
247
|
+
"CravenBrooksSignificantSevere",
|
|
248
|
+
"DerivedVariable",
|
|
249
|
+
"TropicalCycloneTrackVariables",
|
|
250
|
+
"maybe_derive_variables",
|
|
251
|
+
"maybe_include_variables_from_derived_input",
|
|
252
|
+
# inputs
|
|
253
|
+
"ARCO_ERA5_FULL_URI",
|
|
254
|
+
"CIRA_metadata_variable_mapping",
|
|
255
|
+
"DEFAULT_GHCN_URI",
|
|
256
|
+
"ERA5",
|
|
257
|
+
"ERA5_metadata_variable_mapping",
|
|
258
|
+
"EvaluationObject",
|
|
259
|
+
"ForecastBase",
|
|
260
|
+
"GHCN",
|
|
261
|
+
"HRES_metadata_variable_mapping",
|
|
262
|
+
"IBTrACS",
|
|
263
|
+
"IBTrACS_metadata_variable_mapping",
|
|
264
|
+
"IBTRACS_URI",
|
|
265
|
+
"InputBase",
|
|
266
|
+
"KerchunkForecast",
|
|
267
|
+
"LSR",
|
|
268
|
+
"LSR_URI",
|
|
269
|
+
"PPH",
|
|
270
|
+
"PPH_URI",
|
|
271
|
+
"TargetBase",
|
|
272
|
+
"XarrayForecast",
|
|
273
|
+
"ZarrForecast",
|
|
274
|
+
"align_forecast_to_target",
|
|
275
|
+
"check_for_missing_data",
|
|
276
|
+
"maybe_subset_variables",
|
|
277
|
+
"open_kerchunk_reference",
|
|
278
|
+
"zarr_target_subsetter",
|
|
279
|
+
# metrics
|
|
280
|
+
"Accuracy",
|
|
281
|
+
"BaseMetric",
|
|
282
|
+
"CompositeMetric",
|
|
283
|
+
"CriticalSuccessIndex",
|
|
284
|
+
"DurationMeanError",
|
|
285
|
+
"EarlySignal",
|
|
286
|
+
"FalseAlarmRatio",
|
|
287
|
+
"FalseNegatives",
|
|
288
|
+
"FalsePositives",
|
|
289
|
+
"LandfallDisplacement",
|
|
290
|
+
"LandfallIntensityMeanAbsoluteError",
|
|
291
|
+
"LandfallMetric",
|
|
292
|
+
"LandfallTimeMeanError",
|
|
293
|
+
"MaximumLowestMeanAbsoluteError",
|
|
294
|
+
"MaximumMeanAbsoluteError",
|
|
295
|
+
"MeanAbsoluteError",
|
|
296
|
+
"MeanError",
|
|
297
|
+
"MeanSquaredError",
|
|
298
|
+
"MinimumMeanAbsoluteError",
|
|
299
|
+
"RootMeanSquaredError",
|
|
300
|
+
"SpatialDisplacement",
|
|
301
|
+
"ThresholdMetric",
|
|
302
|
+
"TrueNegatives",
|
|
303
|
+
"TruePositives",
|
|
304
|
+
# regions
|
|
305
|
+
"BoundingBoxRegion",
|
|
306
|
+
"CenteredRegion",
|
|
307
|
+
"REGION_TYPES",
|
|
308
|
+
"Region",
|
|
309
|
+
"RegionSubsetter",
|
|
310
|
+
"ShapefileRegion",
|
|
311
|
+
"map_to_create_region",
|
|
312
|
+
"subset_cases_to_region",
|
|
313
|
+
"subset_results_to_region",
|
|
314
|
+
# utils
|
|
315
|
+
"check_for_vars",
|
|
316
|
+
"convert_day_yearofday_to_time",
|
|
317
|
+
"convert_init_time_to_valid_time",
|
|
318
|
+
"convert_longitude_to_180",
|
|
319
|
+
"convert_longitude_to_360",
|
|
320
|
+
"convert_valid_time_to_init_time",
|
|
321
|
+
"derive_indices_from_init_time_and_lead_time",
|
|
322
|
+
"determine_temporal_resolution",
|
|
323
|
+
"extract_tc_names",
|
|
324
|
+
"filter_kwargs_for_callable",
|
|
325
|
+
"find_common_init_times",
|
|
326
|
+
"idx_to_coords",
|
|
327
|
+
"interp_climatology_to_target",
|
|
328
|
+
"is_valid_landfall",
|
|
329
|
+
"load_land_geometry",
|
|
330
|
+
"maybe_cache_and_compute",
|
|
331
|
+
"maybe_densify_dataarray",
|
|
332
|
+
"maybe_get_closest_timestamp_to_center_of_valid_times",
|
|
333
|
+
"maybe_get_operator",
|
|
334
|
+
"min_if_all_timesteps_present",
|
|
335
|
+
"min_if_all_timesteps_present_forecast",
|
|
336
|
+
"read_event_yaml",
|
|
337
|
+
"remove_ocean_gridpoints",
|
|
338
|
+
"stack_dataarray_from_dims",
|
|
339
|
+
]
|