anemoi-datasets 0.5.26__py3-none-any.whl → 0.5.28__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.
- anemoi/datasets/__init__.py +1 -2
- anemoi/datasets/_version.py +16 -3
- anemoi/datasets/commands/check.py +1 -1
- anemoi/datasets/commands/copy.py +1 -2
- anemoi/datasets/commands/create.py +1 -1
- anemoi/datasets/commands/inspect.py +27 -35
- anemoi/datasets/commands/recipe/__init__.py +93 -0
- anemoi/datasets/commands/recipe/format.py +55 -0
- anemoi/datasets/commands/recipe/migrate.py +555 -0
- anemoi/datasets/commands/validate.py +59 -0
- anemoi/datasets/compute/recentre.py +3 -6
- anemoi/datasets/create/__init__.py +64 -26
- anemoi/datasets/create/check.py +10 -12
- anemoi/datasets/create/chunks.py +1 -2
- anemoi/datasets/create/config.py +5 -6
- anemoi/datasets/create/input/__init__.py +44 -65
- anemoi/datasets/create/input/action.py +296 -238
- anemoi/datasets/create/input/context/__init__.py +71 -0
- anemoi/datasets/create/input/context/field.py +54 -0
- anemoi/datasets/create/input/data_sources.py +7 -9
- anemoi/datasets/create/input/misc.py +2 -75
- anemoi/datasets/create/input/repeated_dates.py +11 -130
- anemoi/datasets/{utils → create/input/result}/__init__.py +10 -1
- anemoi/datasets/create/input/{result.py → result/field.py} +36 -120
- anemoi/datasets/create/input/trace.py +1 -1
- anemoi/datasets/create/patch.py +1 -2
- anemoi/datasets/create/persistent.py +3 -5
- anemoi/datasets/create/size.py +1 -3
- anemoi/datasets/create/sources/accumulations.py +120 -145
- anemoi/datasets/create/sources/accumulations2.py +20 -53
- anemoi/datasets/create/sources/anemoi_dataset.py +46 -42
- anemoi/datasets/create/sources/constants.py +39 -40
- anemoi/datasets/create/sources/empty.py +22 -19
- anemoi/datasets/create/sources/fdb.py +133 -0
- anemoi/datasets/create/sources/forcings.py +29 -29
- anemoi/datasets/create/sources/grib.py +94 -78
- anemoi/datasets/create/sources/grib_index.py +57 -55
- anemoi/datasets/create/sources/hindcasts.py +57 -59
- anemoi/datasets/create/sources/legacy.py +10 -62
- anemoi/datasets/create/sources/mars.py +121 -149
- anemoi/datasets/create/sources/netcdf.py +28 -25
- anemoi/datasets/create/sources/opendap.py +28 -26
- anemoi/datasets/create/sources/patterns.py +4 -6
- anemoi/datasets/create/sources/recentre.py +46 -48
- anemoi/datasets/create/sources/repeated_dates.py +44 -0
- anemoi/datasets/create/sources/source.py +26 -51
- anemoi/datasets/create/sources/tendencies.py +68 -98
- anemoi/datasets/create/sources/xarray.py +4 -6
- anemoi/datasets/create/sources/xarray_support/__init__.py +40 -36
- anemoi/datasets/create/sources/xarray_support/coordinates.py +8 -12
- anemoi/datasets/create/sources/xarray_support/field.py +20 -16
- anemoi/datasets/create/sources/xarray_support/fieldlist.py +11 -15
- anemoi/datasets/create/sources/xarray_support/flavour.py +42 -42
- anemoi/datasets/create/sources/xarray_support/grid.py +15 -9
- anemoi/datasets/create/sources/xarray_support/metadata.py +19 -128
- anemoi/datasets/create/sources/xarray_support/patch.py +4 -6
- anemoi/datasets/create/sources/xarray_support/time.py +10 -13
- anemoi/datasets/create/sources/xarray_support/variable.py +21 -21
- anemoi/datasets/create/sources/xarray_zarr.py +28 -25
- anemoi/datasets/create/sources/zenodo.py +43 -41
- anemoi/datasets/create/statistics/__init__.py +3 -6
- anemoi/datasets/create/testing.py +4 -0
- anemoi/datasets/create/typing.py +1 -2
- anemoi/datasets/create/utils.py +0 -43
- anemoi/datasets/create/zarr.py +7 -2
- anemoi/datasets/data/__init__.py +15 -6
- anemoi/datasets/data/complement.py +7 -12
- anemoi/datasets/data/concat.py +5 -8
- anemoi/datasets/data/dataset.py +48 -47
- anemoi/datasets/data/debug.py +7 -9
- anemoi/datasets/data/ensemble.py +4 -6
- anemoi/datasets/data/fill_missing.py +7 -10
- anemoi/datasets/data/forwards.py +22 -26
- anemoi/datasets/data/grids.py +12 -168
- anemoi/datasets/data/indexing.py +9 -12
- anemoi/datasets/data/interpolate.py +7 -15
- anemoi/datasets/data/join.py +8 -12
- anemoi/datasets/data/masked.py +6 -11
- anemoi/datasets/data/merge.py +5 -9
- anemoi/datasets/data/misc.py +41 -45
- anemoi/datasets/data/missing.py +11 -16
- anemoi/datasets/data/observations/__init__.py +8 -14
- anemoi/datasets/data/padded.py +3 -5
- anemoi/datasets/data/records/backends/__init__.py +2 -2
- anemoi/datasets/data/rescale.py +5 -12
- anemoi/datasets/data/rolling_average.py +141 -0
- anemoi/datasets/data/select.py +13 -16
- anemoi/datasets/data/statistics.py +4 -7
- anemoi/datasets/data/stores.py +22 -29
- anemoi/datasets/data/subset.py +8 -11
- anemoi/datasets/data/unchecked.py +7 -11
- anemoi/datasets/data/xy.py +25 -21
- anemoi/datasets/dates/__init__.py +15 -18
- anemoi/datasets/dates/groups.py +7 -10
- anemoi/datasets/dumper.py +76 -0
- anemoi/datasets/grids.py +4 -185
- anemoi/datasets/schemas/recipe.json +131 -0
- anemoi/datasets/testing.py +93 -7
- anemoi/datasets/validate.py +598 -0
- {anemoi_datasets-0.5.26.dist-info → anemoi_datasets-0.5.28.dist-info}/METADATA +7 -4
- anemoi_datasets-0.5.28.dist-info/RECORD +134 -0
- anemoi/datasets/create/filter.py +0 -48
- anemoi/datasets/create/input/concat.py +0 -164
- anemoi/datasets/create/input/context.py +0 -89
- anemoi/datasets/create/input/empty.py +0 -54
- anemoi/datasets/create/input/filter.py +0 -118
- anemoi/datasets/create/input/function.py +0 -233
- anemoi/datasets/create/input/join.py +0 -130
- anemoi/datasets/create/input/pipe.py +0 -66
- anemoi/datasets/create/input/step.py +0 -177
- anemoi/datasets/create/input/template.py +0 -162
- anemoi_datasets-0.5.26.dist-info/RECORD +0 -131
- {anemoi_datasets-0.5.26.dist-info → anemoi_datasets-0.5.28.dist-info}/WHEEL +0 -0
- {anemoi_datasets-0.5.26.dist-info → anemoi_datasets-0.5.28.dist-info}/entry_points.txt +0 -0
- {anemoi_datasets-0.5.26.dist-info → anemoi_datasets-0.5.28.dist-info}/licenses/LICENSE +0 -0
- {anemoi_datasets-0.5.26.dist-info → anemoi_datasets-0.5.28.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
anemoi/datasets/__init__.py,sha256=SPozLbLUFiQ9rtFVRlgeOobFUiFzj-jGo85Tt4YMJp4,1041
|
|
2
|
+
anemoi/datasets/__main__.py,sha256=ErwAqE3rBc7OaNO2JRsEOhWpB8ldjAt7BFSuRhbnlqQ,936
|
|
3
|
+
anemoi/datasets/_version.py,sha256=FrxLJ-xYaOUcy7lfQI_g51sdvDfpiXMvYZawXNIOGcA,706
|
|
4
|
+
anemoi/datasets/check.py,sha256=hbEMUurl2IjZbp56dBgOfAEsAmmgymgRM5ySaMJSTdk,2755
|
|
5
|
+
anemoi/datasets/dumper.py,sha256=Jud4qGooSQjJcPHsJrrYiJ909nM-hvJGXEDK4kfZ0k4,2505
|
|
6
|
+
anemoi/datasets/grids.py,sha256=ugJZznQ4frWH2qlYzV5ds4QLbzsGHwI_q5erVxocFxE,13926
|
|
7
|
+
anemoi/datasets/testing.py,sha256=_vUNMjuWjAm5a7qqtEASHWi-OzpIa52_lHDbqvxnhMQ,4462
|
|
8
|
+
anemoi/datasets/validate.py,sha256=Fnshpn27YwaXoSdj8-fviAtxuvUc0maGSna8U5Z08bA,18300
|
|
9
|
+
anemoi/datasets/commands/__init__.py,sha256=O5W3yHZywRoAqmRUioAr3zMCh0hGVV18wZYGvc00ioM,698
|
|
10
|
+
anemoi/datasets/commands/check.py,sha256=7iOlY3wtgkXqkNZu1_2uG_aAQMSQf2N0aJDPZOyc65c,2650
|
|
11
|
+
anemoi/datasets/commands/cleanup.py,sha256=FX082xkHKCSd8d-FUN5zDBSiKA-QYQEeUZ6dCUD-Ob8,1816
|
|
12
|
+
anemoi/datasets/commands/compare-lam.py,sha256=F5GYRsKOtdhDePhifgf1TCj5L2T8EVIA2N8AdO-AKKY,14857
|
|
13
|
+
anemoi/datasets/commands/compare.py,sha256=jzhjbbt1U-YANTVRBhrwSh2CcYgk4qX2IiTMJtcn82s,3678
|
|
14
|
+
anemoi/datasets/commands/copy.py,sha256=WuKrCSUdZeQwA1HcTQmeJzLA6gGs6BYrcvvmg00QYFM,17271
|
|
15
|
+
anemoi/datasets/commands/create.py,sha256=FIXzQ2Aw0luXRD7Wahvtc2Rbz7WRnQy4Bhom45sjltk,6544
|
|
16
|
+
anemoi/datasets/commands/finalise-additions.py,sha256=GXjGAJILFORXXkE_wfgnk5w4jYug18Q2TpwVah5Ctto,1982
|
|
17
|
+
anemoi/datasets/commands/finalise.py,sha256=cZIiqpJsaN1rqBKOStOA6pJh5n1tisrMFcGGT2UGpKY,1706
|
|
18
|
+
anemoi/datasets/commands/grib-index.py,sha256=0_cISIRw0Iwf6NX5VasxlGbPWX1p7xDMciLglS9G1Yg,3075
|
|
19
|
+
anemoi/datasets/commands/init-additions.py,sha256=wIsintXpf3aG2VhuBJJYI8ZZGXLrum7sM05IX8ImRXk,1928
|
|
20
|
+
anemoi/datasets/commands/init.py,sha256=5IKyJ_hJA4lLIbpT88XtcGzXccHLSGwSoqVSvVJGxPg,2852
|
|
21
|
+
anemoi/datasets/commands/inspect.py,sha256=mpran6kHgpGO8nK7U_MomrrsPEi_k5eaYgLSEAImFJY,26334
|
|
22
|
+
anemoi/datasets/commands/load-additions.py,sha256=bg0JYaPPXhGXKL-p0nngAeI2rPhSTFpZ7bY04mKuSKk,2001
|
|
23
|
+
anemoi/datasets/commands/load.py,sha256=FuKdRYuNlnv_p5ScwPKCiVDEVc9cA1Khvbd-T7N4SvU,2031
|
|
24
|
+
anemoi/datasets/commands/patch.py,sha256=Q9FDabWxlvK1QaeH4D9zhNpoSGB4h7EliWgcV76iFBs,1599
|
|
25
|
+
anemoi/datasets/commands/publish.py,sha256=7YusLCWYdVLuexZzvyh8ztYoBOBzVmve3uJs-XKeMAE,1469
|
|
26
|
+
anemoi/datasets/commands/scan.py,sha256=6Uoyd7WkM4ypoqmZargXIG50uRKzHE3AlvkAr7sCBy4,4262
|
|
27
|
+
anemoi/datasets/commands/validate.py,sha256=mNs29zmPV4glaOC1uPHZsSsv_SWyg1JciR76fmE1xr0,1871
|
|
28
|
+
anemoi/datasets/commands/recipe/__init__.py,sha256=BfA8dKkTQexsPETfi7Wd_Ly0J34g43AL2gxKYHjbD1s,2904
|
|
29
|
+
anemoi/datasets/commands/recipe/format.py,sha256=roq7cXu-7ymjcxQ3IwLOV7beQkJzXvxLXyzquLYxYGU,1244
|
|
30
|
+
anemoi/datasets/commands/recipe/migrate.py,sha256=tBEj9E2nltxrFsvmWeiddg630_YIHTR2E4xToXDqx4M,15547
|
|
31
|
+
anemoi/datasets/compute/__init__.py,sha256=hCW0QcLHJmE-C1r38P27_ZOvCLNewex5iQEtZqx2ckI,393
|
|
32
|
+
anemoi/datasets/compute/recentre.py,sha256=XEyXZIIbSpmmSfuQWikLd562Ml48VdhWHAFK6xGtbeI,5835
|
|
33
|
+
anemoi/datasets/create/__init__.py,sha256=K9kiJAiiniSr533CVfoOn9ePxxBc-1K8FmKw6eF1bN0,51680
|
|
34
|
+
anemoi/datasets/create/check.py,sha256=w8_AhuWxqRjI1c0SdGgfFHcW5rYmBVQuyoS3ncsF9TI,10724
|
|
35
|
+
anemoi/datasets/create/chunks.py,sha256=MBEXTClQyOuYtl96ho8IqQr75hpnWbKe5Li5l6nx_48,3994
|
|
36
|
+
anemoi/datasets/create/config.py,sha256=zc10F5j9NPHYPf2-s-BlLrqOG_0fTPtwcELn_sEGP4c,13356
|
|
37
|
+
anemoi/datasets/create/patch.py,sha256=4852mUbEfM1GCUxIUq56gr6RI_lk8kuWCkG8N80OOqc,5367
|
|
38
|
+
anemoi/datasets/create/persistent.py,sha256=L8Ttk8J4rMWRYgzkFGb5QN4h0tDSizYBXNflCWoEZow,7779
|
|
39
|
+
anemoi/datasets/create/size.py,sha256=2AaD8toBkGO_l8m8UaYX5LSTS4UkU5ULdZAREXZ1JbE,1399
|
|
40
|
+
anemoi/datasets/create/source.py,sha256=xoV8uH_y6aBSE4_PWuy5w7Q7cX-tGm8e-2xC9flSAT4,1336
|
|
41
|
+
anemoi/datasets/create/testing.py,sha256=gANTsosxkUoA44azuXQ2I4lYNopDfFz_ja2oUGUzfNk,73
|
|
42
|
+
anemoi/datasets/create/typing.py,sha256=sy10Tzq6F8zd9jBe4154X60VFAhuZEweOeSo3AgGuDw,460
|
|
43
|
+
anemoi/datasets/create/utils.py,sha256=FZthJUbAQBo-uizcZPgDnTTKdzchfU7JtRuZIxesqN8,4233
|
|
44
|
+
anemoi/datasets/create/writer.py,sha256=nZBJvYZ63g_c9FfL65bAeG10Y6bX2R7CgtZvY0kW3fI,2203
|
|
45
|
+
anemoi/datasets/create/zarr.py,sha256=a_hqvvdiDvl3poEEic-F1LlcwCeo7SvcLLS0sGkiats,9549
|
|
46
|
+
anemoi/datasets/create/input/__init__.py,sha256=VIfTYSxZ2fu43J5srOP3Y7UUdBvlEnOrxbwimjIoi1w,2524
|
|
47
|
+
anemoi/datasets/create/input/action.py,sha256=W5arVY9KhbWltnC_D2r14HBArBSdb8ElmPwnIi3iB40,9363
|
|
48
|
+
anemoi/datasets/create/input/data_sources.py,sha256=o3_LmnDnVIFuA_raSKlIBFeRM35tPN-v9jIVMVwL7WM,4372
|
|
49
|
+
anemoi/datasets/create/input/misc.py,sha256=PLJZl_C2bG3BD0ZFwBTV7Je051zExALpLtHRfKZlYWg,1630
|
|
50
|
+
anemoi/datasets/create/input/repeated_dates.py,sha256=gNgY4paQeuVQtjuyYQm5-ELfiO47VXlf5nCYxopXz8I,8255
|
|
51
|
+
anemoi/datasets/create/input/trace.py,sha256=kVZI1eilg857sKRweGyyDZYb2IjT15a_KWpGCw-dtOU,3329
|
|
52
|
+
anemoi/datasets/create/input/context/__init__.py,sha256=WKdIJv6ywkw7EmSLMxD5k0R-7N9sYrAxL3MF6UieLps,2263
|
|
53
|
+
anemoi/datasets/create/input/context/field.py,sha256=0NWkDYqyDX90gVrBZwz7y2sbICxBp38OUmNdisMFg1U,1605
|
|
54
|
+
anemoi/datasets/create/input/result/__init__.py,sha256=rER6c5hoVxCwPgbrIef74h2DT-V2CqdetOzp5gGD7ww,494
|
|
55
|
+
anemoi/datasets/create/input/result/field.py,sha256=-6EgiHvE8tHQEuwgCaDylCGH3HccT1D-NM9U8-5Lcjc,21645
|
|
56
|
+
anemoi/datasets/create/sources/__init__.py,sha256=XNiiGaC6NbxnGfl6glPw-gTJASi3vsGKwVlfkMqYGk4,950
|
|
57
|
+
anemoi/datasets/create/sources/accumulations.py,sha256=3TKhkyOJHN29bJm-leooJlewTRCWEpyhgqIc2Z_Vj_M,32171
|
|
58
|
+
anemoi/datasets/create/sources/accumulations2.py,sha256=ytOURbfIdp2S95X1DLqmjxbK_wsW4QE8qS9kv-LCGRI,19940
|
|
59
|
+
anemoi/datasets/create/sources/anemoi_dataset.py,sha256=mu9URoxLj3zOX9FwSCvWTezQr_AgigJ2BMG5LKTy8Eg,2286
|
|
60
|
+
anemoi/datasets/create/sources/constants.py,sha256=rZ7pGal4ein6ta0CeyWUitgODo9Jhudx2OejPiiqiBQ,1665
|
|
61
|
+
anemoi/datasets/create/sources/eccc_fstd.py,sha256=8HK38f444HcWMvBhooP0XqTfMXYoCbN_8G9RI_Ne5rc,659
|
|
62
|
+
anemoi/datasets/create/sources/empty.py,sha256=QQzbI2NJ0Z4X9DvECKJkqDiCO_SfzpBUpfWHj-GoXOk,1152
|
|
63
|
+
anemoi/datasets/create/sources/fdb.py,sha256=AkxvW7vZqJs2AbwYEzfkU5j3Udk4gTaGx2Pbwsa5qNk,4396
|
|
64
|
+
anemoi/datasets/create/sources/forcings.py,sha256=hy1oyC1Zjg1uzO2UWfNiTJXfQRaM_B8vs8X7GXXO4Nc,1356
|
|
65
|
+
anemoi/datasets/create/sources/grib.py,sha256=G1qLyZYZxUFr54IIrRQbeKTnpkZ5zjFH16_f-m6gurY,5060
|
|
66
|
+
anemoi/datasets/create/sources/grib_index.py,sha256=iQfjHmdI2w_1p-8S42sowYlBzGezON7VERRXv63ELZk,19206
|
|
67
|
+
anemoi/datasets/create/sources/hindcasts.py,sha256=4QuTSbaP5SfGFOdRSqm4jf__r7tMFx0lgPOlOVC6BEg,2773
|
|
68
|
+
anemoi/datasets/create/sources/legacy.py,sha256=Lv8MgFvdpP6ygu6_wGI47dpq7nuvuSbaHJAiUGqC4z8,1254
|
|
69
|
+
anemoi/datasets/create/sources/mars.py,sha256=TDcA9OqtJBANS4aCviILQUIEYZ1xG6K3KBXcRnchtyU,12998
|
|
70
|
+
anemoi/datasets/create/sources/netcdf.py,sha256=6PlDpskth2xn_ad7rCzhH5GOqwps6bCRq7zFdkoGJsQ,1372
|
|
71
|
+
anemoi/datasets/create/sources/opendap.py,sha256=ZvMqTgcDl8k_CY8CLzxaW79cBxvVOo0e9Jd1bhLGBoA,1382
|
|
72
|
+
anemoi/datasets/create/sources/patterns.py,sha256=dLCWz7nJtqMI4v9Qytiun-iUs4Lkv-4i7pbA19hoQe8,2243
|
|
73
|
+
anemoi/datasets/create/sources/planetary_computer.py,sha256=Erk6fKJt63gj_pgbklBWhAKjzjtAfq_DRizMfWdqPPU,1578
|
|
74
|
+
anemoi/datasets/create/sources/recentre.py,sha256=hgBQFbgDXvr0DfFejdnLYkU7Hqs9634F7Sg3VMxIPk0,4155
|
|
75
|
+
anemoi/datasets/create/sources/repeated_dates.py,sha256=IM3YFep2ClC8eTJk7GGkIpyUO_gM3UqwPO87oJTXhg4,1730
|
|
76
|
+
anemoi/datasets/create/sources/source.py,sha256=Srf_68kXrkk5N8lnWmrazcsKVUw5PAhv5Ry-5-OAxRM,1643
|
|
77
|
+
anemoi/datasets/create/sources/tendencies.py,sha256=BpZXKAZC9BsG8V1heoS7ai1IIIFhh0Hng_j-gW8mnMA,5159
|
|
78
|
+
anemoi/datasets/create/sources/xarray.py,sha256=6c2Ss2I795Y3Xj9Qbr4Voiwcq7SaZFLaq1G_5lh_kAs,2491
|
|
79
|
+
anemoi/datasets/create/sources/xarray_kerchunk.py,sha256=vdFaFzze8VLjYUgIX8Lc39ELvwmgfT3ioyxBHAt4nrs,1136
|
|
80
|
+
anemoi/datasets/create/sources/xarray_zarr.py,sha256=tOcA1rUam0rwAYSIXe2QB9cSNW--NCLlGK_Ou78FIec,1360
|
|
81
|
+
anemoi/datasets/create/sources/zenodo.py,sha256=6NvK5KLMtb39a-YBs44sgPyc2k9NZU6oeYNbU8Lh98g,2259
|
|
82
|
+
anemoi/datasets/create/sources/xarray_support/README.md,sha256=56olM9Jh0vI0_bU9GI-IqbBcz4DZXWONqvdzN_VeAFE,78
|
|
83
|
+
anemoi/datasets/create/sources/xarray_support/__init__.py,sha256=GG7utzXImjKNZBt-tr4GlKRvSS-NZKLTLLKvzx_X7JM,4876
|
|
84
|
+
anemoi/datasets/create/sources/xarray_support/coordinates.py,sha256=bwjRl7yWT56YlR8thypIR85Ro8iSNMkRGLgjgmbJS6Q,11055
|
|
85
|
+
anemoi/datasets/create/sources/xarray_support/field.py,sha256=lo5V7pMcVt3j_nbntt7mweGCXkUGNANq35stW69zrCo,6550
|
|
86
|
+
anemoi/datasets/create/sources/xarray_support/fieldlist.py,sha256=BqLeP8ObTd3Ze7O6jsFJqX9aXD7E352vIT8ZtySv9_0,8158
|
|
87
|
+
anemoi/datasets/create/sources/xarray_support/flavour.py,sha256=5ZGnzErbfuUogcnLBfUrNcg_JCMb6vbwLnwlzaWiaV0,33302
|
|
88
|
+
anemoi/datasets/create/sources/xarray_support/grid.py,sha256=4VLpWBCkFaRErFsjW8AzY4L-xeSoMYoQhxRor3hQqs8,6496
|
|
89
|
+
anemoi/datasets/create/sources/xarray_support/metadata.py,sha256=CR9MYneZH49kJw-G1Ie2Vhevs-fliPUzKohiMfO-sWs,7838
|
|
90
|
+
anemoi/datasets/create/sources/xarray_support/patch.py,sha256=vAImOFec9_ryOX_ZGIYzeb7fSlaso1cU0hlnqipbAW4,2979
|
|
91
|
+
anemoi/datasets/create/sources/xarray_support/time.py,sha256=S-tvA5QZIMh0wQnQa51FotK9oxE8JTpUqfSYimF_Hwo,12401
|
|
92
|
+
anemoi/datasets/create/sources/xarray_support/variable.py,sha256=8Cekc5YOpZx_MNFEHMM2cE91ydjY-YBUhB7wX17wkVs,9288
|
|
93
|
+
anemoi/datasets/create/statistics/__init__.py,sha256=xe8WE7xezM6EDhRywOGRmK1c8mim1k6FhXnEw8yHnBQ,18199
|
|
94
|
+
anemoi/datasets/create/statistics/summary.py,sha256=JdtChTmsr1Y958_nka36HltTbeZkawuGbprbfZD7Ux8,4790
|
|
95
|
+
anemoi/datasets/data/__init__.py,sha256=WKWn_k4bKRUbzRO-5Mp89gV6DeuBuMb00WisD_M-ypI,3200
|
|
96
|
+
anemoi/datasets/data/complement.py,sha256=WgdKNEBp_jsOFPTAYqSudmbk2QItbKO4GWuUT-chJuU,11864
|
|
97
|
+
anemoi/datasets/data/concat.py,sha256=ArOLD7mrZUw6yzaObSzNWlMKZWH74gaYBx0AvjSCFps,8921
|
|
98
|
+
anemoi/datasets/data/dataset.py,sha256=UBIPMNqoCqE2QYk-z13UQCwcBfRbvFI12Wx63nmfUKM,32393
|
|
99
|
+
anemoi/datasets/data/debug.css,sha256=z2X_ZDSnZ9C3pyZPWnQiEyAxuMxUaxJxET4oaCImTAQ,211
|
|
100
|
+
anemoi/datasets/data/debug.py,sha256=DUG_Rr5sYbXENSFMbtDZuG4IEwvDF-EoqF45z16tHso,10747
|
|
101
|
+
anemoi/datasets/data/ensemble.py,sha256=N_43HcgcvFmYnU3afyobjx9nZIGtb5WDTVSDXFQPwWE,5303
|
|
102
|
+
anemoi/datasets/data/fill_missing.py,sha256=Ic2icBvVnj34DpRperiyd8U_VjeI9ygIJdFzdmttK_I,8710
|
|
103
|
+
anemoi/datasets/data/forwards.py,sha256=dixet1sv_E5yUL6To2M-Z0BpzpF4-TwEw8acnb9XO4Y,20012
|
|
104
|
+
anemoi/datasets/data/grids.py,sha256=HbahQBCS1MIH-lj2PEwtZlROAhWHMaxsUT9hGC4bvPE,17380
|
|
105
|
+
anemoi/datasets/data/indexing.py,sha256=5JhiRTBUrj2tOmhSmrFyugw_kOOIKOdtZnoq2Cfgj_k,7444
|
|
106
|
+
anemoi/datasets/data/interpolate.py,sha256=n1klwVIwIyBSnMtjOqPh09MkhVqO5CTCH6xYkaLVhlM,9099
|
|
107
|
+
anemoi/datasets/data/join.py,sha256=EjgnjXKNbEUVaQEMzoJ7sv63vApwhDtkcJutxhZ1H5g,9110
|
|
108
|
+
anemoi/datasets/data/masked.py,sha256=6D6ygKNddp3xc-vjxNFuT-Pfh4jwfYnCds96Y0dCTH0,10078
|
|
109
|
+
anemoi/datasets/data/merge.py,sha256=zdF7-OKouN-iE3-Km-g5MZfyARg85IepQWQrSeUsG7w,8637
|
|
110
|
+
anemoi/datasets/data/misc.py,sha256=iGbZg6EEheJlIH-AECTLnf-30lXaQXG-ngfbwFIt5CM,22862
|
|
111
|
+
anemoi/datasets/data/missing.py,sha256=TUZCr5Vtx23_0R9fl0RZF9fgKnJq2d_wuVMmrMm8L9w,12457
|
|
112
|
+
anemoi/datasets/data/padded.py,sha256=sunn3QRThlfUHJOGE04s008F-v7kT7gY_i2E6wulCdk,7834
|
|
113
|
+
anemoi/datasets/data/rescale.py,sha256=xTj2Vn8YuyB1KWW5y37B2HHilTVdCcuNCnYHoiQFRBg,6859
|
|
114
|
+
anemoi/datasets/data/rolling_average.py,sha256=Ng7Te_8bHp7wOH_ARnvqtLI0Weze-uXLO3FP60gaJlU,5107
|
|
115
|
+
anemoi/datasets/data/select.py,sha256=hScUbJya1Nsew4PCmwYdTix2CtngDXTNezH_cHUdaJs,8198
|
|
116
|
+
anemoi/datasets/data/statistics.py,sha256=Z4Kffb1uIDwueWHD8XpbiV5la_XXRCAHCHFI4HfHyZI,3095
|
|
117
|
+
anemoi/datasets/data/stores.py,sha256=rifv6bJYGbAttNn6dqpR5ajyaVBlLLzj50B4zRwcRkE,17914
|
|
118
|
+
anemoi/datasets/data/subset.py,sha256=XTOf4xzbRLanefaewvSZH3okStsThusFsiyyQo0CMpc,8888
|
|
119
|
+
anemoi/datasets/data/unchecked.py,sha256=KxUrd_yilo4aZk99ALJSrmICEUbXhJP3iOhfac11Fb4,7218
|
|
120
|
+
anemoi/datasets/data/xy.py,sha256=raecf5OrsgUDE30rri80r7yIYkvhHd15Hb9vo_7bzCw,7675
|
|
121
|
+
anemoi/datasets/data/observations/__init__.py,sha256=V9vd7M3FqcwwGTIQk2frhvEQs3w_J4_QwIknmRAyEvg,11119
|
|
122
|
+
anemoi/datasets/data/observations/legacy_obs_dataset.py,sha256=6Aj32XWmNmCsd0azhuB6aDcpDaJ7lRdgJ9KWlU9fXxs,7342
|
|
123
|
+
anemoi/datasets/data/observations/multi.py,sha256=nDeN99LRNVyjUCNTFCL3R7iAQNsf1tSen-fSw9-VsiY,2184
|
|
124
|
+
anemoi/datasets/data/records/__init__.py,sha256=lWJBukNArbBBdcfG8bh5MzJoSOjk5Fi8zcwHWo5a0I8,12405
|
|
125
|
+
anemoi/datasets/data/records/backends/__init__.py,sha256=u894d7duXMiGTOQh5WfuxTsA4Fgj0KraBu2QqWRV3xA,5237
|
|
126
|
+
anemoi/datasets/dates/__init__.py,sha256=4WFEG8tujrXOT6nbpy6BufBqcqGfECnvG42rmxgLh9w,13476
|
|
127
|
+
anemoi/datasets/dates/groups.py,sha256=bdA6YjFtNlgFAXiov5-zFHZ3C_QtUrdQiSFgb2zWxVM,10034
|
|
128
|
+
anemoi/datasets/schemas/recipe.json,sha256=UvfOQYKcTz-OrJv4is-qe-rhUNBrrmpcpXF32jB0Oz4,3208
|
|
129
|
+
anemoi_datasets-0.5.28.dist-info/licenses/LICENSE,sha256=8HznKF1Vi2IvfLsKNE5A2iVyiri3pRjRPvPC9kxs6qk,11354
|
|
130
|
+
anemoi_datasets-0.5.28.dist-info/METADATA,sha256=mMdaVPhO3aSpaaECZMT5x_tItQDmXEKhbXfrwbN2miA,16227
|
|
131
|
+
anemoi_datasets-0.5.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
132
|
+
anemoi_datasets-0.5.28.dist-info/entry_points.txt,sha256=yR-o-4uiPEA_GLBL81SkMYnUoxq3CAV3hHulQiRtGG0,66
|
|
133
|
+
anemoi_datasets-0.5.28.dist-info/top_level.txt,sha256=DYn8VPs-fNwr7fNH9XIBqeXIwiYYd2E2k5-dUFFqUz0,7
|
|
134
|
+
anemoi_datasets-0.5.28.dist-info/RECORD,,
|
anemoi/datasets/create/filter.py
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# (C) Copyright 2025- Anemoi contributors.
|
|
2
|
-
#
|
|
3
|
-
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
4
|
-
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
5
|
-
#
|
|
6
|
-
# In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
-
# granted to it by virtue of its status as an intergovernmental organisation
|
|
8
|
-
# nor does it submit to any jurisdiction.
|
|
9
|
-
|
|
10
|
-
from typing import Any
|
|
11
|
-
from typing import Dict
|
|
12
|
-
|
|
13
|
-
import earthkit.data as ekd
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class TransformFilter:
|
|
17
|
-
"""Calls filters from anemoi.transform.filters
|
|
18
|
-
|
|
19
|
-
Parameters
|
|
20
|
-
----------
|
|
21
|
-
context : Any
|
|
22
|
-
The context in which the filter is created.
|
|
23
|
-
name : str
|
|
24
|
-
The name of the filter.
|
|
25
|
-
config : Dict[str, Any]
|
|
26
|
-
The configuration for the filter.
|
|
27
|
-
"""
|
|
28
|
-
|
|
29
|
-
def __init__(self, context: Any, name: str, config: Dict[str, Any]) -> None:
|
|
30
|
-
from anemoi.transform.filters import create_filter
|
|
31
|
-
|
|
32
|
-
self.name = name
|
|
33
|
-
self.transform_filter = create_filter(context, config)
|
|
34
|
-
|
|
35
|
-
def execute(self, input: ekd.FieldList) -> ekd.FieldList:
|
|
36
|
-
"""Execute the transformation filter.
|
|
37
|
-
|
|
38
|
-
Parameters
|
|
39
|
-
----------
|
|
40
|
-
input : ekd.FieldList
|
|
41
|
-
The input data to be transformed.
|
|
42
|
-
|
|
43
|
-
Returns
|
|
44
|
-
-------
|
|
45
|
-
ekd.FieldList
|
|
46
|
-
The transformed data.
|
|
47
|
-
"""
|
|
48
|
-
return self.transform_filter.forward(input)
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
# (C) Copyright 2024 Anemoi contributors.
|
|
2
|
-
#
|
|
3
|
-
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
4
|
-
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
5
|
-
#
|
|
6
|
-
# In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
-
# granted to it by virtue of its status as an intergovernmental organisation
|
|
8
|
-
# nor does it submit to any jurisdiction.
|
|
9
|
-
|
|
10
|
-
import logging
|
|
11
|
-
from copy import deepcopy
|
|
12
|
-
from functools import cached_property
|
|
13
|
-
from typing import Any
|
|
14
|
-
from typing import Dict
|
|
15
|
-
from typing import List
|
|
16
|
-
from typing import Union
|
|
17
|
-
|
|
18
|
-
from earthkit.data import FieldList
|
|
19
|
-
|
|
20
|
-
from anemoi.datasets.dates import DatesProvider
|
|
21
|
-
|
|
22
|
-
from ...dates.groups import GroupOfDates
|
|
23
|
-
from .action import Action
|
|
24
|
-
from .action import action_factory
|
|
25
|
-
from .empty import EmptyResult
|
|
26
|
-
from .misc import _tidy
|
|
27
|
-
from .misc import assert_fieldlist
|
|
28
|
-
from .result import Result
|
|
29
|
-
from .template import notify_result
|
|
30
|
-
from .trace import trace_datasource
|
|
31
|
-
from .trace import trace_select
|
|
32
|
-
|
|
33
|
-
LOG = logging.getLogger(__name__)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class ConcatResult(Result):
|
|
37
|
-
"""Represents the result of concatenating multiple results."""
|
|
38
|
-
|
|
39
|
-
def __init__(
|
|
40
|
-
self,
|
|
41
|
-
context: object,
|
|
42
|
-
action_path: List[str],
|
|
43
|
-
group_of_dates: GroupOfDates,
|
|
44
|
-
results: List[Result],
|
|
45
|
-
**kwargs: Any,
|
|
46
|
-
) -> None:
|
|
47
|
-
"""Initializes a ConcatResult instance.
|
|
48
|
-
|
|
49
|
-
Parameters
|
|
50
|
-
----------
|
|
51
|
-
context : object
|
|
52
|
-
The context object.
|
|
53
|
-
action_path : List[str]
|
|
54
|
-
The action path.
|
|
55
|
-
group_of_dates : GroupOfDates
|
|
56
|
-
The group of dates.
|
|
57
|
-
results : List[Result]
|
|
58
|
-
The list of results.
|
|
59
|
-
kwargs : Any
|
|
60
|
-
Additional keyword arguments.
|
|
61
|
-
"""
|
|
62
|
-
super().__init__(context, action_path, group_of_dates)
|
|
63
|
-
self.results = [r for r in results if not r.empty]
|
|
64
|
-
|
|
65
|
-
@cached_property
|
|
66
|
-
@assert_fieldlist
|
|
67
|
-
@notify_result
|
|
68
|
-
@trace_datasource
|
|
69
|
-
def datasource(self) -> FieldList:
|
|
70
|
-
"""Returns the concatenated datasource from all results."""
|
|
71
|
-
ds = EmptyResult(self.context, self.action_path, self.group_of_dates).datasource
|
|
72
|
-
for i in self.results:
|
|
73
|
-
ds += i.datasource
|
|
74
|
-
return _tidy(ds)
|
|
75
|
-
|
|
76
|
-
@property
|
|
77
|
-
def variables(self) -> List[str]:
|
|
78
|
-
"""Returns the list of variables, ensuring all results have the same variables."""
|
|
79
|
-
variables = None
|
|
80
|
-
for f in self.results:
|
|
81
|
-
if f.empty:
|
|
82
|
-
continue
|
|
83
|
-
if variables is None:
|
|
84
|
-
variables = f.variables
|
|
85
|
-
assert variables == f.variables, (variables, f.variables)
|
|
86
|
-
assert variables is not None, self.results
|
|
87
|
-
return variables
|
|
88
|
-
|
|
89
|
-
def __repr__(self) -> str:
|
|
90
|
-
"""Returns a string representation of the ConcatResult instance.
|
|
91
|
-
|
|
92
|
-
Returns
|
|
93
|
-
-------
|
|
94
|
-
str
|
|
95
|
-
A string representation of the ConcatResult instance.
|
|
96
|
-
"""
|
|
97
|
-
content = "\n".join([str(i) for i in self.results])
|
|
98
|
-
return self._repr(content)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
class ConcatAction(Action):
|
|
102
|
-
"""Represents an action that concatenates multiple actions based on their dates."""
|
|
103
|
-
|
|
104
|
-
def __init__(self, context: object, action_path: List[str], *configs: Dict[str, Any]) -> None:
|
|
105
|
-
"""Initializes a ConcatAction instance.
|
|
106
|
-
|
|
107
|
-
Parameters
|
|
108
|
-
----------
|
|
109
|
-
context : object
|
|
110
|
-
The context object.
|
|
111
|
-
action_path : List[str]
|
|
112
|
-
The action path.
|
|
113
|
-
configs : Dict[str, Any]
|
|
114
|
-
The configuration dictionaries.
|
|
115
|
-
"""
|
|
116
|
-
super().__init__(context, action_path, *configs)
|
|
117
|
-
parts = []
|
|
118
|
-
for i, cfg in enumerate(configs):
|
|
119
|
-
if "dates" not in cfg:
|
|
120
|
-
raise ValueError(f"Missing 'dates' in {cfg}")
|
|
121
|
-
cfg = deepcopy(cfg)
|
|
122
|
-
dates_cfg = cfg.pop("dates")
|
|
123
|
-
assert isinstance(dates_cfg, dict), dates_cfg
|
|
124
|
-
filtering_dates = DatesProvider.from_config(**dates_cfg)
|
|
125
|
-
action = action_factory(cfg, context, action_path + [str(i)])
|
|
126
|
-
parts.append((filtering_dates, action))
|
|
127
|
-
self.parts = parts
|
|
128
|
-
|
|
129
|
-
def __repr__(self) -> str:
|
|
130
|
-
"""Returns a string representation of the ConcatAction instance.
|
|
131
|
-
|
|
132
|
-
Returns
|
|
133
|
-
-------
|
|
134
|
-
str
|
|
135
|
-
A string representation of the ConcatAction instance.
|
|
136
|
-
"""
|
|
137
|
-
content = "\n".join([str(i) for i in self.parts])
|
|
138
|
-
return self._repr(content)
|
|
139
|
-
|
|
140
|
-
@trace_select
|
|
141
|
-
def select(self, group_of_dates: GroupOfDates) -> Union[ConcatResult, EmptyResult]:
|
|
142
|
-
"""Selects the concatenated result for the given group of dates.
|
|
143
|
-
|
|
144
|
-
Parameters
|
|
145
|
-
----------
|
|
146
|
-
group_of_dates : GroupOfDates
|
|
147
|
-
The group of dates.
|
|
148
|
-
|
|
149
|
-
Returns
|
|
150
|
-
-------
|
|
151
|
-
Union[ConcatResult, EmptyResult]
|
|
152
|
-
The concatenated result or an empty result.
|
|
153
|
-
"""
|
|
154
|
-
from anemoi.datasets.dates.groups import GroupOfDates
|
|
155
|
-
|
|
156
|
-
results = []
|
|
157
|
-
for filtering_dates, action in self.parts:
|
|
158
|
-
newdates = GroupOfDates(sorted(set(group_of_dates) & set(filtering_dates)), group_of_dates.provider)
|
|
159
|
-
if newdates:
|
|
160
|
-
results.append(action.select(newdates))
|
|
161
|
-
if not results:
|
|
162
|
-
return EmptyResult(self.context, self.action_path, group_of_dates)
|
|
163
|
-
|
|
164
|
-
return ConcatResult(self.context, self.action_path, group_of_dates, results)
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# (C) Copyright 2024 Anemoi contributors.
|
|
2
|
-
#
|
|
3
|
-
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
4
|
-
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
5
|
-
#
|
|
6
|
-
# In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
-
# granted to it by virtue of its status as an intergovernmental organisation
|
|
8
|
-
# nor does it submit to any jurisdiction.
|
|
9
|
-
|
|
10
|
-
import logging
|
|
11
|
-
import textwrap
|
|
12
|
-
from typing import Any
|
|
13
|
-
from typing import List
|
|
14
|
-
from typing import Tuple
|
|
15
|
-
from typing import Union
|
|
16
|
-
|
|
17
|
-
from anemoi.utils.humanize import plural
|
|
18
|
-
|
|
19
|
-
from .trace import step
|
|
20
|
-
from .trace import trace
|
|
21
|
-
|
|
22
|
-
LOG = logging.getLogger(__name__)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class Context:
|
|
26
|
-
"""Class to handle the build context in the dataset creation process."""
|
|
27
|
-
|
|
28
|
-
def __init__(self) -> None:
|
|
29
|
-
"""Initializes a Context instance."""
|
|
30
|
-
# used_references is a set of reference paths that will be needed
|
|
31
|
-
self.used_references = set()
|
|
32
|
-
# results is a dictionary of reference path -> obj
|
|
33
|
-
self.results = {}
|
|
34
|
-
|
|
35
|
-
def will_need_reference(self, key: Union[List, Tuple]) -> None:
|
|
36
|
-
"""Marks a reference as needed.
|
|
37
|
-
|
|
38
|
-
Parameters
|
|
39
|
-
----------
|
|
40
|
-
key : Union[List, Tuple]
|
|
41
|
-
The reference key.
|
|
42
|
-
"""
|
|
43
|
-
assert isinstance(key, (list, tuple)), key
|
|
44
|
-
key = tuple(key)
|
|
45
|
-
self.used_references.add(key)
|
|
46
|
-
|
|
47
|
-
def notify_result(self, key: Union[List, Tuple], result: Any) -> None:
|
|
48
|
-
"""Notifies that a result is available for a reference.
|
|
49
|
-
|
|
50
|
-
Parameters
|
|
51
|
-
----------
|
|
52
|
-
key : Union[List, Tuple]
|
|
53
|
-
The reference key.
|
|
54
|
-
result : Any
|
|
55
|
-
The result object.
|
|
56
|
-
"""
|
|
57
|
-
trace(
|
|
58
|
-
"🎯",
|
|
59
|
-
step(key),
|
|
60
|
-
"notify result",
|
|
61
|
-
textwrap.shorten(repr(result).replace(",", ", "), width=40),
|
|
62
|
-
plural(len(result), "field"),
|
|
63
|
-
)
|
|
64
|
-
assert isinstance(key, (list, tuple)), key
|
|
65
|
-
key = tuple(key)
|
|
66
|
-
if key in self.used_references:
|
|
67
|
-
if key in self.results:
|
|
68
|
-
raise ValueError(f"Duplicate result {key}")
|
|
69
|
-
self.results[key] = result
|
|
70
|
-
|
|
71
|
-
def get_result(self, key: Union[List, Tuple]) -> Any:
|
|
72
|
-
"""Retrieves the result for a given reference.
|
|
73
|
-
|
|
74
|
-
Parameters
|
|
75
|
-
----------
|
|
76
|
-
key : Union[List, Tuple]
|
|
77
|
-
The reference key.
|
|
78
|
-
|
|
79
|
-
Returns
|
|
80
|
-
-------
|
|
81
|
-
Any
|
|
82
|
-
The result for the given reference.
|
|
83
|
-
"""
|
|
84
|
-
assert isinstance(key, (list, tuple)), key
|
|
85
|
-
key = tuple(key)
|
|
86
|
-
if key in self.results:
|
|
87
|
-
return self.results[key]
|
|
88
|
-
all_keys = sorted(list(self.results.keys()))
|
|
89
|
-
raise ValueError(f"Cannot find result {key} in {all_keys}")
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# (C) Copyright 2024 Anemoi contributors.
|
|
2
|
-
#
|
|
3
|
-
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
4
|
-
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
5
|
-
#
|
|
6
|
-
# In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
-
# granted to it by virtue of its status as an intergovernmental organisation
|
|
8
|
-
# nor does it submit to any jurisdiction.
|
|
9
|
-
|
|
10
|
-
import logging
|
|
11
|
-
from functools import cached_property
|
|
12
|
-
from typing import List
|
|
13
|
-
|
|
14
|
-
from earthkit.data import FieldList
|
|
15
|
-
|
|
16
|
-
from .misc import assert_fieldlist
|
|
17
|
-
from .result import Result
|
|
18
|
-
from .trace import trace_datasource
|
|
19
|
-
|
|
20
|
-
LOG = logging.getLogger(__name__)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class EmptyResult(Result):
|
|
24
|
-
"""Class to represent an empty result in the dataset creation process."""
|
|
25
|
-
|
|
26
|
-
empty = True
|
|
27
|
-
|
|
28
|
-
def __init__(self, context: object, action_path: list, dates: object) -> None:
|
|
29
|
-
"""Initializes an EmptyResult instance.
|
|
30
|
-
|
|
31
|
-
Parameters
|
|
32
|
-
----------
|
|
33
|
-
context : object
|
|
34
|
-
The context object.
|
|
35
|
-
action_path : list
|
|
36
|
-
The action path.
|
|
37
|
-
dates : object
|
|
38
|
-
The dates object.
|
|
39
|
-
"""
|
|
40
|
-
super().__init__(context, action_path + ["empty"], dates)
|
|
41
|
-
|
|
42
|
-
@cached_property
|
|
43
|
-
@assert_fieldlist
|
|
44
|
-
@trace_datasource
|
|
45
|
-
def datasource(self) -> FieldList:
|
|
46
|
-
"""Returns an empty datasource."""
|
|
47
|
-
from earthkit.data import from_source
|
|
48
|
-
|
|
49
|
-
return from_source("empty")
|
|
50
|
-
|
|
51
|
-
@property
|
|
52
|
-
def variables(self) -> List[str]:
|
|
53
|
-
"""Returns an empty list of variables."""
|
|
54
|
-
return []
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
# (C) Copyright 2024 Anemoi contributors.
|
|
2
|
-
#
|
|
3
|
-
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
4
|
-
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
5
|
-
#
|
|
6
|
-
# In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
-
# granted to it by virtue of its status as an intergovernmental organisation
|
|
8
|
-
# nor does it submit to any jurisdiction.
|
|
9
|
-
|
|
10
|
-
import logging
|
|
11
|
-
from functools import cached_property
|
|
12
|
-
from typing import Any
|
|
13
|
-
from typing import Type
|
|
14
|
-
|
|
15
|
-
from earthkit.data import FieldList
|
|
16
|
-
|
|
17
|
-
from .function import FunctionContext
|
|
18
|
-
from .misc import _tidy
|
|
19
|
-
from .misc import assert_fieldlist
|
|
20
|
-
from .step import StepAction
|
|
21
|
-
from .step import StepResult
|
|
22
|
-
from .template import notify_result
|
|
23
|
-
from .trace import trace_datasource
|
|
24
|
-
|
|
25
|
-
LOG = logging.getLogger(__name__)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class FilterStepResult(StepResult):
|
|
29
|
-
@property
|
|
30
|
-
@notify_result
|
|
31
|
-
@assert_fieldlist
|
|
32
|
-
@trace_datasource
|
|
33
|
-
def datasource(self) -> FieldList:
|
|
34
|
-
"""Returns the filtered datasource."""
|
|
35
|
-
ds: FieldList = self.upstream_result.datasource
|
|
36
|
-
ds = ds.sel(**self.action.kwargs)
|
|
37
|
-
return _tidy(ds)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
class FilterStepAction(StepAction):
|
|
41
|
-
"""Represents an action to filter a step result."""
|
|
42
|
-
|
|
43
|
-
result_class: Type[FilterStepResult] = FilterStepResult
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class StepFunctionResult(StepResult):
|
|
47
|
-
@cached_property
|
|
48
|
-
@assert_fieldlist
|
|
49
|
-
@notify_result
|
|
50
|
-
@trace_datasource
|
|
51
|
-
def datasource(self) -> FieldList:
|
|
52
|
-
"""Returns the datasource after applying the function."""
|
|
53
|
-
|
|
54
|
-
self.action.filter.context = FunctionContext(self)
|
|
55
|
-
try:
|
|
56
|
-
return _tidy(
|
|
57
|
-
self.action.filter.execute(
|
|
58
|
-
self.upstream_result.datasource,
|
|
59
|
-
*self.action.args[1:],
|
|
60
|
-
**self.action.kwargs,
|
|
61
|
-
)
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
except Exception:
|
|
65
|
-
LOG.error(f"Error in {self.action.name}", exc_info=True)
|
|
66
|
-
raise
|
|
67
|
-
|
|
68
|
-
def _trace_datasource(self, *args: Any, **kwargs: Any) -> str:
|
|
69
|
-
"""Traces the datasource for the given arguments.
|
|
70
|
-
|
|
71
|
-
Parameters
|
|
72
|
-
----------
|
|
73
|
-
*args : Any
|
|
74
|
-
The arguments.
|
|
75
|
-
**kwargs : Any
|
|
76
|
-
The keyword arguments.
|
|
77
|
-
|
|
78
|
-
Returns
|
|
79
|
-
-------
|
|
80
|
-
str
|
|
81
|
-
A string representation of the traced datasource.
|
|
82
|
-
"""
|
|
83
|
-
return f"{self.action.name}({self.group_of_dates})"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
class FunctionStepAction(StepAction):
|
|
87
|
-
"""Represents an action to apply a function to a step result."""
|
|
88
|
-
|
|
89
|
-
result_class: Type[StepFunctionResult] = StepFunctionResult
|
|
90
|
-
|
|
91
|
-
def __init__(
|
|
92
|
-
self,
|
|
93
|
-
context: object,
|
|
94
|
-
action_path: list,
|
|
95
|
-
previous_step: StepAction,
|
|
96
|
-
name: str,
|
|
97
|
-
filter: Any,
|
|
98
|
-
*args: Any,
|
|
99
|
-
**kwargs: Any,
|
|
100
|
-
) -> None:
|
|
101
|
-
"""Initializes a FunctionStepAction instance.
|
|
102
|
-
|
|
103
|
-
Parameters
|
|
104
|
-
----------
|
|
105
|
-
context : object
|
|
106
|
-
The context object.
|
|
107
|
-
action_path : list
|
|
108
|
-
The action path.
|
|
109
|
-
previous_step : StepAction
|
|
110
|
-
The previous step action.
|
|
111
|
-
*args : Any
|
|
112
|
-
Additional arguments.
|
|
113
|
-
**kwargs : Any
|
|
114
|
-
Additional keyword arguments.
|
|
115
|
-
"""
|
|
116
|
-
super().__init__(context, action_path, previous_step, *args, **kwargs)
|
|
117
|
-
self.name = name
|
|
118
|
-
self.filter = filter
|