anemoi-datasets 0.5.27__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/_version.py +2 -2
- 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/create/__init__.py +42 -1
- anemoi/datasets/create/config.py +2 -0
- anemoi/datasets/create/input/__init__.py +43 -63
- anemoi/datasets/create/input/action.py +296 -236
- 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 +2 -1
- anemoi/datasets/create/input/misc.py +0 -71
- anemoi/datasets/create/input/repeated_dates.py +0 -114
- anemoi/datasets/create/input/result/__init__.py +17 -0
- anemoi/datasets/create/input/{result.py → result/field.py} +9 -89
- anemoi/datasets/create/sources/accumulations.py +74 -94
- anemoi/datasets/create/sources/accumulations2.py +16 -45
- anemoi/datasets/create/sources/anemoi_dataset.py +46 -42
- anemoi/datasets/create/sources/constants.py +39 -38
- anemoi/datasets/create/sources/empty.py +26 -22
- anemoi/datasets/create/sources/forcings.py +29 -28
- anemoi/datasets/create/sources/grib.py +92 -72
- anemoi/datasets/create/sources/grib_index.py +46 -42
- anemoi/datasets/create/sources/hindcasts.py +56 -55
- anemoi/datasets/create/sources/legacy.py +10 -62
- anemoi/datasets/create/sources/mars.py +107 -131
- anemoi/datasets/create/sources/netcdf.py +28 -24
- anemoi/datasets/create/sources/opendap.py +28 -24
- anemoi/datasets/create/sources/recentre.py +42 -41
- anemoi/datasets/create/sources/repeated_dates.py +44 -0
- anemoi/datasets/create/sources/source.py +26 -48
- anemoi/datasets/create/sources/tendencies.py +67 -94
- anemoi/datasets/create/sources/xarray_support/__init__.py +29 -24
- anemoi/datasets/create/sources/xarray_support/field.py +4 -4
- anemoi/datasets/create/sources/xarray_zarr.py +28 -24
- anemoi/datasets/create/sources/zenodo.py +43 -39
- anemoi/datasets/create/utils.py +0 -42
- anemoi/datasets/data/dataset.py +6 -0
- anemoi/datasets/data/grids.py +0 -152
- anemoi/datasets/data/rolling_average.py +141 -0
- anemoi/datasets/data/stores.py +7 -9
- anemoi/datasets/dates/__init__.py +2 -0
- anemoi/datasets/dumper.py +76 -0
- anemoi/datasets/grids.py +1 -178
- anemoi/datasets/schemas/recipe.json +131 -0
- {anemoi_datasets-0.5.27.dist-info → anemoi_datasets-0.5.28.dist-info}/METADATA +5 -2
- {anemoi_datasets-0.5.27.dist-info → anemoi_datasets-0.5.28.dist-info}/RECORD +51 -51
- anemoi/datasets/create/filter.py +0 -47
- anemoi/datasets/create/input/concat.py +0 -161
- anemoi/datasets/create/input/context.py +0 -86
- anemoi/datasets/create/input/empty.py +0 -53
- anemoi/datasets/create/input/filter.py +0 -117
- anemoi/datasets/create/input/function.py +0 -232
- anemoi/datasets/create/input/join.py +0 -129
- anemoi/datasets/create/input/pipe.py +0 -66
- anemoi/datasets/create/input/step.py +0 -173
- anemoi/datasets/create/input/template.py +0 -161
- {anemoi_datasets-0.5.27.dist-info → anemoi_datasets-0.5.28.dist-info}/WHEEL +0 -0
- {anemoi_datasets-0.5.27.dist-info → anemoi_datasets-0.5.28.dist-info}/entry_points.txt +0 -0
- {anemoi_datasets-0.5.27.dist-info → anemoi_datasets-0.5.28.dist-info}/licenses/LICENSE +0 -0
- {anemoi_datasets-0.5.27.dist-info → anemoi_datasets-0.5.28.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"$id": "https://ecmwf.int/anemoi-datasets-recipe.schema.json",
|
|
5
|
+
"title": "Product",
|
|
6
|
+
"description": "Anemoi datasets recipe configuration",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"$defs": {
|
|
9
|
+
"source-or-filter": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"minProperties": 1,
|
|
12
|
+
"maxProperties": 1
|
|
13
|
+
},
|
|
14
|
+
"pipe": {
|
|
15
|
+
"type": "array",
|
|
16
|
+
"items": {
|
|
17
|
+
"$ref": "#/$defs/input-object"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"join": {
|
|
21
|
+
"type": "array",
|
|
22
|
+
"items": {
|
|
23
|
+
"$ref": "#/$defs/input-object"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"concat": {
|
|
27
|
+
"type": "array",
|
|
28
|
+
"items": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"minProperties": 2,
|
|
31
|
+
"maxProperties": 2,
|
|
32
|
+
"required": [
|
|
33
|
+
"dates"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"input-object": {
|
|
38
|
+
"oneOf": [
|
|
39
|
+
{
|
|
40
|
+
"$ref": "#/$defs/pipe"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"$ref": "#/$defs/join"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"$ref": "#/$defs/concat"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"$ref": "#/$defs/source-or-filter"
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"properties": {
|
|
55
|
+
"env": {
|
|
56
|
+
"type": "object"
|
|
57
|
+
},
|
|
58
|
+
"description": {
|
|
59
|
+
"type": "string"
|
|
60
|
+
},
|
|
61
|
+
"name": {
|
|
62
|
+
"type": "string"
|
|
63
|
+
},
|
|
64
|
+
"licence": {
|
|
65
|
+
"type": "string"
|
|
66
|
+
},
|
|
67
|
+
"attribution": {
|
|
68
|
+
"type": "string"
|
|
69
|
+
},
|
|
70
|
+
"dates": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"required": [
|
|
73
|
+
"start",
|
|
74
|
+
"end"
|
|
75
|
+
],
|
|
76
|
+
"properties": {
|
|
77
|
+
"start": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"format": "date"
|
|
80
|
+
},
|
|
81
|
+
"end": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"format": "date"
|
|
84
|
+
},
|
|
85
|
+
"frequency": {
|
|
86
|
+
"type": [
|
|
87
|
+
"integer",
|
|
88
|
+
"string"
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
"group_by": {
|
|
92
|
+
"type": [
|
|
93
|
+
"integer",
|
|
94
|
+
"string"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"input": {
|
|
100
|
+
"$ref": "#/$defs/input-object"
|
|
101
|
+
},
|
|
102
|
+
"data_sources": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"patternProperties": {
|
|
105
|
+
"^[a-zA-Z_][a-zA-Z0-9_]*$": {
|
|
106
|
+
"$ref": "#/$defs/input-object"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"additionalProperties": false
|
|
110
|
+
},
|
|
111
|
+
"output": {
|
|
112
|
+
"type": "object"
|
|
113
|
+
},
|
|
114
|
+
"statistics": {
|
|
115
|
+
"type": "object"
|
|
116
|
+
},
|
|
117
|
+
"build": {
|
|
118
|
+
"type": "object"
|
|
119
|
+
},
|
|
120
|
+
"common": {
|
|
121
|
+
"type": "object"
|
|
122
|
+
},
|
|
123
|
+
"platform": {
|
|
124
|
+
"type": "object"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"required": [
|
|
128
|
+
"dates",
|
|
129
|
+
"input"
|
|
130
|
+
]
|
|
131
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: anemoi-datasets
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.28
|
|
4
4
|
Summary: A package to hold various functions to support training of ML models on ECMWF data.
|
|
5
5
|
Author-email: "European Centre for Medium-Range Weather Forecasts (ECMWF)" <software.support@ecmwf.int>
|
|
6
6
|
License: Apache License
|
|
@@ -225,11 +225,14 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
|
225
225
|
Requires-Python: >=3.10
|
|
226
226
|
License-File: LICENSE
|
|
227
227
|
Requires-Dist: anemoi-transform>=0.1.10
|
|
228
|
-
Requires-Dist: anemoi-utils[provenance]>=0.4.
|
|
228
|
+
Requires-Dist: anemoi-utils[provenance]>=0.4.38
|
|
229
229
|
Requires-Dist: cfunits
|
|
230
|
+
Requires-Dist: glom
|
|
231
|
+
Requires-Dist: jsonschema
|
|
230
232
|
Requires-Dist: numcodecs<0.16
|
|
231
233
|
Requires-Dist: numpy
|
|
232
234
|
Requires-Dist: pyyaml
|
|
235
|
+
Requires-Dist: ruamel-yaml
|
|
233
236
|
Requires-Dist: semantic-version
|
|
234
237
|
Requires-Dist: tqdm
|
|
235
238
|
Requires-Dist: zarr<=2.18.4
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
anemoi/datasets/__init__.py,sha256=SPozLbLUFiQ9rtFVRlgeOobFUiFzj-jGo85Tt4YMJp4,1041
|
|
2
2
|
anemoi/datasets/__main__.py,sha256=ErwAqE3rBc7OaNO2JRsEOhWpB8ldjAt7BFSuRhbnlqQ,936
|
|
3
|
-
anemoi/datasets/_version.py,sha256=
|
|
3
|
+
anemoi/datasets/_version.py,sha256=FrxLJ-xYaOUcy7lfQI_g51sdvDfpiXMvYZawXNIOGcA,706
|
|
4
4
|
anemoi/datasets/check.py,sha256=hbEMUurl2IjZbp56dBgOfAEsAmmgymgRM5ySaMJSTdk,2755
|
|
5
|
-
anemoi/datasets/
|
|
5
|
+
anemoi/datasets/dumper.py,sha256=Jud4qGooSQjJcPHsJrrYiJ909nM-hvJGXEDK4kfZ0k4,2505
|
|
6
|
+
anemoi/datasets/grids.py,sha256=ugJZznQ4frWH2qlYzV5ds4QLbzsGHwI_q5erVxocFxE,13926
|
|
6
7
|
anemoi/datasets/testing.py,sha256=_vUNMjuWjAm5a7qqtEASHWi-OzpIa52_lHDbqvxnhMQ,4462
|
|
7
8
|
anemoi/datasets/validate.py,sha256=Fnshpn27YwaXoSdj8-fviAtxuvUc0maGSna8U5Z08bA,18300
|
|
8
9
|
anemoi/datasets/commands/__init__.py,sha256=O5W3yHZywRoAqmRUioAr3zMCh0hGVV18wZYGvc00ioM,698
|
|
@@ -24,67 +25,64 @@ anemoi/datasets/commands/patch.py,sha256=Q9FDabWxlvK1QaeH4D9zhNpoSGB4h7EliWgcV76
|
|
|
24
25
|
anemoi/datasets/commands/publish.py,sha256=7YusLCWYdVLuexZzvyh8ztYoBOBzVmve3uJs-XKeMAE,1469
|
|
25
26
|
anemoi/datasets/commands/scan.py,sha256=6Uoyd7WkM4ypoqmZargXIG50uRKzHE3AlvkAr7sCBy4,4262
|
|
26
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
|
|
27
31
|
anemoi/datasets/compute/__init__.py,sha256=hCW0QcLHJmE-C1r38P27_ZOvCLNewex5iQEtZqx2ckI,393
|
|
28
32
|
anemoi/datasets/compute/recentre.py,sha256=XEyXZIIbSpmmSfuQWikLd562Ml48VdhWHAFK6xGtbeI,5835
|
|
29
|
-
anemoi/datasets/create/__init__.py,sha256=
|
|
33
|
+
anemoi/datasets/create/__init__.py,sha256=K9kiJAiiniSr533CVfoOn9ePxxBc-1K8FmKw6eF1bN0,51680
|
|
30
34
|
anemoi/datasets/create/check.py,sha256=w8_AhuWxqRjI1c0SdGgfFHcW5rYmBVQuyoS3ncsF9TI,10724
|
|
31
35
|
anemoi/datasets/create/chunks.py,sha256=MBEXTClQyOuYtl96ho8IqQr75hpnWbKe5Li5l6nx_48,3994
|
|
32
|
-
anemoi/datasets/create/config.py,sha256=
|
|
33
|
-
anemoi/datasets/create/filter.py,sha256=EaBp3AbGERY8aFs08fZ1eioAclkc0Gy2ucQawWTolBc,1356
|
|
36
|
+
anemoi/datasets/create/config.py,sha256=zc10F5j9NPHYPf2-s-BlLrqOG_0fTPtwcELn_sEGP4c,13356
|
|
34
37
|
anemoi/datasets/create/patch.py,sha256=4852mUbEfM1GCUxIUq56gr6RI_lk8kuWCkG8N80OOqc,5367
|
|
35
38
|
anemoi/datasets/create/persistent.py,sha256=L8Ttk8J4rMWRYgzkFGb5QN4h0tDSizYBXNflCWoEZow,7779
|
|
36
39
|
anemoi/datasets/create/size.py,sha256=2AaD8toBkGO_l8m8UaYX5LSTS4UkU5ULdZAREXZ1JbE,1399
|
|
37
40
|
anemoi/datasets/create/source.py,sha256=xoV8uH_y6aBSE4_PWuy5w7Q7cX-tGm8e-2xC9flSAT4,1336
|
|
38
41
|
anemoi/datasets/create/testing.py,sha256=gANTsosxkUoA44azuXQ2I4lYNopDfFz_ja2oUGUzfNk,73
|
|
39
42
|
anemoi/datasets/create/typing.py,sha256=sy10Tzq6F8zd9jBe4154X60VFAhuZEweOeSo3AgGuDw,460
|
|
40
|
-
anemoi/datasets/create/utils.py,sha256=
|
|
43
|
+
anemoi/datasets/create/utils.py,sha256=FZthJUbAQBo-uizcZPgDnTTKdzchfU7JtRuZIxesqN8,4233
|
|
41
44
|
anemoi/datasets/create/writer.py,sha256=nZBJvYZ63g_c9FfL65bAeG10Y6bX2R7CgtZvY0kW3fI,2203
|
|
42
45
|
anemoi/datasets/create/zarr.py,sha256=a_hqvvdiDvl3poEEic-F1LlcwCeo7SvcLLS0sGkiats,9549
|
|
43
|
-
anemoi/datasets/create/input/__init__.py,sha256=
|
|
44
|
-
anemoi/datasets/create/input/action.py,sha256=
|
|
45
|
-
anemoi/datasets/create/input/
|
|
46
|
-
anemoi/datasets/create/input/
|
|
47
|
-
anemoi/datasets/create/input/
|
|
48
|
-
anemoi/datasets/create/input/empty.py,sha256=E_ZbB1q_wVUY0yKPXEHUiVtL8U2cikqbaZgJv81pZnE,1510
|
|
49
|
-
anemoi/datasets/create/input/filter.py,sha256=v_pS8-xmXz1B5O4NbdUmxfAQWNNmqtNETw-L_nVIweE,3289
|
|
50
|
-
anemoi/datasets/create/input/function.py,sha256=T5r94FfE_JYxRExtDv1pkoWzuXqZIbKVzm2aIvqo45g,6892
|
|
51
|
-
anemoi/datasets/create/input/join.py,sha256=EGLljUKtMs6cGt17ICv8s-esmt7vnZyvs-sATYA6acQ,3992
|
|
52
|
-
anemoi/datasets/create/input/misc.py,sha256=_2Y2r3o0VgNSss01AsZUh-rfQCv1hCa1KDagC9gYHZI,3292
|
|
53
|
-
anemoi/datasets/create/input/pipe.py,sha256=-tCz161IwXoI8pl1hilA9T_j5eHSr-sgbijFLp9HHNc,2083
|
|
54
|
-
anemoi/datasets/create/input/repeated_dates.py,sha256=UZeRpI93tgJr13-I4BvhS2ECbkZSM0zic5s_MfYGACs,11885
|
|
55
|
-
anemoi/datasets/create/input/result.py,sha256=0OMf9O9190JgZ3IBIpY1qbfH5Fhzzi4Uq5c0SUTG2SU,24187
|
|
56
|
-
anemoi/datasets/create/input/step.py,sha256=ikfs4TQeuNV9qAotM85C57Lu6R1WVS4n40Lps3m9b_A,5273
|
|
57
|
-
anemoi/datasets/create/input/template.py,sha256=O3IjT_GIdGaqjwG8_R35tMKZ9d4Tn6brPLH-t9MG-HU,4077
|
|
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
|
|
58
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
|
|
59
56
|
anemoi/datasets/create/sources/__init__.py,sha256=XNiiGaC6NbxnGfl6glPw-gTJASi3vsGKwVlfkMqYGk4,950
|
|
60
|
-
anemoi/datasets/create/sources/accumulations.py,sha256=
|
|
61
|
-
anemoi/datasets/create/sources/accumulations2.py,sha256=
|
|
62
|
-
anemoi/datasets/create/sources/anemoi_dataset.py,sha256=
|
|
63
|
-
anemoi/datasets/create/sources/constants.py,sha256=
|
|
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
|
|
64
61
|
anemoi/datasets/create/sources/eccc_fstd.py,sha256=8HK38f444HcWMvBhooP0XqTfMXYoCbN_8G9RI_Ne5rc,659
|
|
65
|
-
anemoi/datasets/create/sources/empty.py,sha256=
|
|
62
|
+
anemoi/datasets/create/sources/empty.py,sha256=QQzbI2NJ0Z4X9DvECKJkqDiCO_SfzpBUpfWHj-GoXOk,1152
|
|
66
63
|
anemoi/datasets/create/sources/fdb.py,sha256=AkxvW7vZqJs2AbwYEzfkU5j3Udk4gTaGx2Pbwsa5qNk,4396
|
|
67
|
-
anemoi/datasets/create/sources/forcings.py,sha256=
|
|
68
|
-
anemoi/datasets/create/sources/grib.py,sha256
|
|
69
|
-
anemoi/datasets/create/sources/grib_index.py,sha256=
|
|
70
|
-
anemoi/datasets/create/sources/hindcasts.py,sha256=
|
|
71
|
-
anemoi/datasets/create/sources/legacy.py,sha256=
|
|
72
|
-
anemoi/datasets/create/sources/mars.py,sha256=
|
|
73
|
-
anemoi/datasets/create/sources/netcdf.py,sha256=
|
|
74
|
-
anemoi/datasets/create/sources/opendap.py,sha256=
|
|
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
|
|
75
72
|
anemoi/datasets/create/sources/patterns.py,sha256=dLCWz7nJtqMI4v9Qytiun-iUs4Lkv-4i7pbA19hoQe8,2243
|
|
76
73
|
anemoi/datasets/create/sources/planetary_computer.py,sha256=Erk6fKJt63gj_pgbklBWhAKjzjtAfq_DRizMfWdqPPU,1578
|
|
77
|
-
anemoi/datasets/create/sources/recentre.py,sha256=
|
|
78
|
-
anemoi/datasets/create/sources/
|
|
79
|
-
anemoi/datasets/create/sources/
|
|
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
|
|
80
78
|
anemoi/datasets/create/sources/xarray.py,sha256=6c2Ss2I795Y3Xj9Qbr4Voiwcq7SaZFLaq1G_5lh_kAs,2491
|
|
81
79
|
anemoi/datasets/create/sources/xarray_kerchunk.py,sha256=vdFaFzze8VLjYUgIX8Lc39ELvwmgfT3ioyxBHAt4nrs,1136
|
|
82
|
-
anemoi/datasets/create/sources/xarray_zarr.py,sha256=
|
|
83
|
-
anemoi/datasets/create/sources/zenodo.py,sha256=
|
|
80
|
+
anemoi/datasets/create/sources/xarray_zarr.py,sha256=tOcA1rUam0rwAYSIXe2QB9cSNW--NCLlGK_Ou78FIec,1360
|
|
81
|
+
anemoi/datasets/create/sources/zenodo.py,sha256=6NvK5KLMtb39a-YBs44sgPyc2k9NZU6oeYNbU8Lh98g,2259
|
|
84
82
|
anemoi/datasets/create/sources/xarray_support/README.md,sha256=56olM9Jh0vI0_bU9GI-IqbBcz4DZXWONqvdzN_VeAFE,78
|
|
85
|
-
anemoi/datasets/create/sources/xarray_support/__init__.py,sha256=
|
|
83
|
+
anemoi/datasets/create/sources/xarray_support/__init__.py,sha256=GG7utzXImjKNZBt-tr4GlKRvSS-NZKLTLLKvzx_X7JM,4876
|
|
86
84
|
anemoi/datasets/create/sources/xarray_support/coordinates.py,sha256=bwjRl7yWT56YlR8thypIR85Ro8iSNMkRGLgjgmbJS6Q,11055
|
|
87
|
-
anemoi/datasets/create/sources/xarray_support/field.py,sha256=
|
|
85
|
+
anemoi/datasets/create/sources/xarray_support/field.py,sha256=lo5V7pMcVt3j_nbntt7mweGCXkUGNANq35stW69zrCo,6550
|
|
88
86
|
anemoi/datasets/create/sources/xarray_support/fieldlist.py,sha256=BqLeP8ObTd3Ze7O6jsFJqX9aXD7E352vIT8ZtySv9_0,8158
|
|
89
87
|
anemoi/datasets/create/sources/xarray_support/flavour.py,sha256=5ZGnzErbfuUogcnLBfUrNcg_JCMb6vbwLnwlzaWiaV0,33302
|
|
90
88
|
anemoi/datasets/create/sources/xarray_support/grid.py,sha256=4VLpWBCkFaRErFsjW8AzY4L-xeSoMYoQhxRor3hQqs8,6496
|
|
@@ -97,13 +95,13 @@ anemoi/datasets/create/statistics/summary.py,sha256=JdtChTmsr1Y958_nka36HltTbeZk
|
|
|
97
95
|
anemoi/datasets/data/__init__.py,sha256=WKWn_k4bKRUbzRO-5Mp89gV6DeuBuMb00WisD_M-ypI,3200
|
|
98
96
|
anemoi/datasets/data/complement.py,sha256=WgdKNEBp_jsOFPTAYqSudmbk2QItbKO4GWuUT-chJuU,11864
|
|
99
97
|
anemoi/datasets/data/concat.py,sha256=ArOLD7mrZUw6yzaObSzNWlMKZWH74gaYBx0AvjSCFps,8921
|
|
100
|
-
anemoi/datasets/data/dataset.py,sha256=
|
|
98
|
+
anemoi/datasets/data/dataset.py,sha256=UBIPMNqoCqE2QYk-z13UQCwcBfRbvFI12Wx63nmfUKM,32393
|
|
101
99
|
anemoi/datasets/data/debug.css,sha256=z2X_ZDSnZ9C3pyZPWnQiEyAxuMxUaxJxET4oaCImTAQ,211
|
|
102
100
|
anemoi/datasets/data/debug.py,sha256=DUG_Rr5sYbXENSFMbtDZuG4IEwvDF-EoqF45z16tHso,10747
|
|
103
101
|
anemoi/datasets/data/ensemble.py,sha256=N_43HcgcvFmYnU3afyobjx9nZIGtb5WDTVSDXFQPwWE,5303
|
|
104
102
|
anemoi/datasets/data/fill_missing.py,sha256=Ic2icBvVnj34DpRperiyd8U_VjeI9ygIJdFzdmttK_I,8710
|
|
105
103
|
anemoi/datasets/data/forwards.py,sha256=dixet1sv_E5yUL6To2M-Z0BpzpF4-TwEw8acnb9XO4Y,20012
|
|
106
|
-
anemoi/datasets/data/grids.py,sha256=
|
|
104
|
+
anemoi/datasets/data/grids.py,sha256=HbahQBCS1MIH-lj2PEwtZlROAhWHMaxsUT9hGC4bvPE,17380
|
|
107
105
|
anemoi/datasets/data/indexing.py,sha256=5JhiRTBUrj2tOmhSmrFyugw_kOOIKOdtZnoq2Cfgj_k,7444
|
|
108
106
|
anemoi/datasets/data/interpolate.py,sha256=n1klwVIwIyBSnMtjOqPh09MkhVqO5CTCH6xYkaLVhlM,9099
|
|
109
107
|
anemoi/datasets/data/join.py,sha256=EjgnjXKNbEUVaQEMzoJ7sv63vApwhDtkcJutxhZ1H5g,9110
|
|
@@ -113,9 +111,10 @@ anemoi/datasets/data/misc.py,sha256=iGbZg6EEheJlIH-AECTLnf-30lXaQXG-ngfbwFIt5CM,
|
|
|
113
111
|
anemoi/datasets/data/missing.py,sha256=TUZCr5Vtx23_0R9fl0RZF9fgKnJq2d_wuVMmrMm8L9w,12457
|
|
114
112
|
anemoi/datasets/data/padded.py,sha256=sunn3QRThlfUHJOGE04s008F-v7kT7gY_i2E6wulCdk,7834
|
|
115
113
|
anemoi/datasets/data/rescale.py,sha256=xTj2Vn8YuyB1KWW5y37B2HHilTVdCcuNCnYHoiQFRBg,6859
|
|
114
|
+
anemoi/datasets/data/rolling_average.py,sha256=Ng7Te_8bHp7wOH_ARnvqtLI0Weze-uXLO3FP60gaJlU,5107
|
|
116
115
|
anemoi/datasets/data/select.py,sha256=hScUbJya1Nsew4PCmwYdTix2CtngDXTNezH_cHUdaJs,8198
|
|
117
116
|
anemoi/datasets/data/statistics.py,sha256=Z4Kffb1uIDwueWHD8XpbiV5la_XXRCAHCHFI4HfHyZI,3095
|
|
118
|
-
anemoi/datasets/data/stores.py,sha256=
|
|
117
|
+
anemoi/datasets/data/stores.py,sha256=rifv6bJYGbAttNn6dqpR5ajyaVBlLLzj50B4zRwcRkE,17914
|
|
119
118
|
anemoi/datasets/data/subset.py,sha256=XTOf4xzbRLanefaewvSZH3okStsThusFsiyyQo0CMpc,8888
|
|
120
119
|
anemoi/datasets/data/unchecked.py,sha256=KxUrd_yilo4aZk99ALJSrmICEUbXhJP3iOhfac11Fb4,7218
|
|
121
120
|
anemoi/datasets/data/xy.py,sha256=raecf5OrsgUDE30rri80r7yIYkvhHd15Hb9vo_7bzCw,7675
|
|
@@ -124,11 +123,12 @@ anemoi/datasets/data/observations/legacy_obs_dataset.py,sha256=6Aj32XWmNmCsd0azh
|
|
|
124
123
|
anemoi/datasets/data/observations/multi.py,sha256=nDeN99LRNVyjUCNTFCL3R7iAQNsf1tSen-fSw9-VsiY,2184
|
|
125
124
|
anemoi/datasets/data/records/__init__.py,sha256=lWJBukNArbBBdcfG8bh5MzJoSOjk5Fi8zcwHWo5a0I8,12405
|
|
126
125
|
anemoi/datasets/data/records/backends/__init__.py,sha256=u894d7duXMiGTOQh5WfuxTsA4Fgj0KraBu2QqWRV3xA,5237
|
|
127
|
-
anemoi/datasets/dates/__init__.py,sha256=
|
|
126
|
+
anemoi/datasets/dates/__init__.py,sha256=4WFEG8tujrXOT6nbpy6BufBqcqGfECnvG42rmxgLh9w,13476
|
|
128
127
|
anemoi/datasets/dates/groups.py,sha256=bdA6YjFtNlgFAXiov5-zFHZ3C_QtUrdQiSFgb2zWxVM,10034
|
|
129
|
-
|
|
130
|
-
anemoi_datasets-0.5.
|
|
131
|
-
anemoi_datasets-0.5.
|
|
132
|
-
anemoi_datasets-0.5.
|
|
133
|
-
anemoi_datasets-0.5.
|
|
134
|
-
anemoi_datasets-0.5.
|
|
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,47 +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
|
-
|
|
12
|
-
import earthkit.data as ekd
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class TransformFilter:
|
|
16
|
-
"""Calls filters from anemoi.transform.filters
|
|
17
|
-
|
|
18
|
-
Parameters
|
|
19
|
-
----------
|
|
20
|
-
context : Any
|
|
21
|
-
The context in which the filter is created.
|
|
22
|
-
name : str
|
|
23
|
-
The name of the filter.
|
|
24
|
-
config : Dict[str, Any]
|
|
25
|
-
The configuration for the filter.
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
def __init__(self, context: Any, name: str, config: dict[str, Any]) -> None:
|
|
29
|
-
from anemoi.transform.filters import create_filter
|
|
30
|
-
|
|
31
|
-
self.name = name
|
|
32
|
-
self.transform_filter = create_filter(context, config)
|
|
33
|
-
|
|
34
|
-
def execute(self, input: ekd.FieldList) -> ekd.FieldList:
|
|
35
|
-
"""Execute the transformation filter.
|
|
36
|
-
|
|
37
|
-
Parameters
|
|
38
|
-
----------
|
|
39
|
-
input : ekd.FieldList
|
|
40
|
-
The input data to be transformed.
|
|
41
|
-
|
|
42
|
-
Returns
|
|
43
|
-
-------
|
|
44
|
-
ekd.FieldList
|
|
45
|
-
The transformed data.
|
|
46
|
-
"""
|
|
47
|
-
return self.transform_filter.forward(input)
|
|
@@ -1,161 +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
|
-
|
|
15
|
-
from earthkit.data import FieldList
|
|
16
|
-
|
|
17
|
-
from anemoi.datasets.dates import DatesProvider
|
|
18
|
-
|
|
19
|
-
from ...dates.groups import GroupOfDates
|
|
20
|
-
from .action import Action
|
|
21
|
-
from .action import action_factory
|
|
22
|
-
from .empty import EmptyResult
|
|
23
|
-
from .misc import _tidy
|
|
24
|
-
from .misc import assert_fieldlist
|
|
25
|
-
from .result import Result
|
|
26
|
-
from .template import notify_result
|
|
27
|
-
from .trace import trace_datasource
|
|
28
|
-
from .trace import trace_select
|
|
29
|
-
|
|
30
|
-
LOG = logging.getLogger(__name__)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class ConcatResult(Result):
|
|
34
|
-
"""Represents the result of concatenating multiple results."""
|
|
35
|
-
|
|
36
|
-
def __init__(
|
|
37
|
-
self,
|
|
38
|
-
context: object,
|
|
39
|
-
action_path: list[str],
|
|
40
|
-
group_of_dates: GroupOfDates,
|
|
41
|
-
results: list[Result],
|
|
42
|
-
**kwargs: Any,
|
|
43
|
-
) -> None:
|
|
44
|
-
"""Initializes a ConcatResult instance.
|
|
45
|
-
|
|
46
|
-
Parameters
|
|
47
|
-
----------
|
|
48
|
-
context : object
|
|
49
|
-
The context object.
|
|
50
|
-
action_path : List[str]
|
|
51
|
-
The action path.
|
|
52
|
-
group_of_dates : GroupOfDates
|
|
53
|
-
The group of dates.
|
|
54
|
-
results : List[Result]
|
|
55
|
-
The list of results.
|
|
56
|
-
kwargs : Any
|
|
57
|
-
Additional keyword arguments.
|
|
58
|
-
"""
|
|
59
|
-
super().__init__(context, action_path, group_of_dates)
|
|
60
|
-
self.results = [r for r in results if not r.empty]
|
|
61
|
-
|
|
62
|
-
@cached_property
|
|
63
|
-
@assert_fieldlist
|
|
64
|
-
@notify_result
|
|
65
|
-
@trace_datasource
|
|
66
|
-
def datasource(self) -> FieldList:
|
|
67
|
-
"""Returns the concatenated datasource from all results."""
|
|
68
|
-
ds = EmptyResult(self.context, self.action_path, self.group_of_dates).datasource
|
|
69
|
-
for i in self.results:
|
|
70
|
-
ds += i.datasource
|
|
71
|
-
return _tidy(ds)
|
|
72
|
-
|
|
73
|
-
@property
|
|
74
|
-
def variables(self) -> list[str]:
|
|
75
|
-
"""Returns the list of variables, ensuring all results have the same variables."""
|
|
76
|
-
variables = None
|
|
77
|
-
for f in self.results:
|
|
78
|
-
if f.empty:
|
|
79
|
-
continue
|
|
80
|
-
if variables is None:
|
|
81
|
-
variables = f.variables
|
|
82
|
-
assert variables == f.variables, (variables, f.variables)
|
|
83
|
-
assert variables is not None, self.results
|
|
84
|
-
return variables
|
|
85
|
-
|
|
86
|
-
def __repr__(self) -> str:
|
|
87
|
-
"""Returns a string representation of the ConcatResult instance.
|
|
88
|
-
|
|
89
|
-
Returns
|
|
90
|
-
-------
|
|
91
|
-
str
|
|
92
|
-
A string representation of the ConcatResult instance.
|
|
93
|
-
"""
|
|
94
|
-
content = "\n".join([str(i) for i in self.results])
|
|
95
|
-
return self._repr(content)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
class ConcatAction(Action):
|
|
99
|
-
"""Represents an action that concatenates multiple actions based on their dates."""
|
|
100
|
-
|
|
101
|
-
def __init__(self, context: object, action_path: list[str], *configs: dict[str, Any]) -> None:
|
|
102
|
-
"""Initializes a ConcatAction instance.
|
|
103
|
-
|
|
104
|
-
Parameters
|
|
105
|
-
----------
|
|
106
|
-
context : object
|
|
107
|
-
The context object.
|
|
108
|
-
action_path : List[str]
|
|
109
|
-
The action path.
|
|
110
|
-
configs : Dict[str, Any]
|
|
111
|
-
The configuration dictionaries.
|
|
112
|
-
"""
|
|
113
|
-
super().__init__(context, action_path, *configs)
|
|
114
|
-
parts = []
|
|
115
|
-
for i, cfg in enumerate(configs):
|
|
116
|
-
if "dates" not in cfg:
|
|
117
|
-
raise ValueError(f"Missing 'dates' in {cfg}")
|
|
118
|
-
cfg = deepcopy(cfg)
|
|
119
|
-
dates_cfg = cfg.pop("dates")
|
|
120
|
-
assert isinstance(dates_cfg, dict), dates_cfg
|
|
121
|
-
filtering_dates = DatesProvider.from_config(**dates_cfg)
|
|
122
|
-
action = action_factory(cfg, context, action_path + [str(i)])
|
|
123
|
-
parts.append((filtering_dates, action))
|
|
124
|
-
self.parts = parts
|
|
125
|
-
|
|
126
|
-
def __repr__(self) -> str:
|
|
127
|
-
"""Returns a string representation of the ConcatAction instance.
|
|
128
|
-
|
|
129
|
-
Returns
|
|
130
|
-
-------
|
|
131
|
-
str
|
|
132
|
-
A string representation of the ConcatAction instance.
|
|
133
|
-
"""
|
|
134
|
-
content = "\n".join([str(i) for i in self.parts])
|
|
135
|
-
return self._repr(content)
|
|
136
|
-
|
|
137
|
-
@trace_select
|
|
138
|
-
def select(self, group_of_dates: GroupOfDates) -> ConcatResult | EmptyResult:
|
|
139
|
-
"""Selects the concatenated result for the given group of dates.
|
|
140
|
-
|
|
141
|
-
Parameters
|
|
142
|
-
----------
|
|
143
|
-
group_of_dates : GroupOfDates
|
|
144
|
-
The group of dates.
|
|
145
|
-
|
|
146
|
-
Returns
|
|
147
|
-
-------
|
|
148
|
-
Union[ConcatResult, EmptyResult]
|
|
149
|
-
The concatenated result or an empty result.
|
|
150
|
-
"""
|
|
151
|
-
from anemoi.datasets.dates.groups import GroupOfDates
|
|
152
|
-
|
|
153
|
-
results = []
|
|
154
|
-
for filtering_dates, action in self.parts:
|
|
155
|
-
newdates = GroupOfDates(sorted(set(group_of_dates) & set(filtering_dates)), group_of_dates.provider)
|
|
156
|
-
if newdates:
|
|
157
|
-
results.append(action.select(newdates))
|
|
158
|
-
if not results:
|
|
159
|
-
return EmptyResult(self.context, self.action_path, group_of_dates)
|
|
160
|
-
|
|
161
|
-
return ConcatResult(self.context, self.action_path, group_of_dates, results)
|
|
@@ -1,86 +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
|
-
|
|
14
|
-
from anemoi.utils.humanize import plural
|
|
15
|
-
|
|
16
|
-
from .trace import step
|
|
17
|
-
from .trace import trace
|
|
18
|
-
|
|
19
|
-
LOG = logging.getLogger(__name__)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class Context:
|
|
23
|
-
"""Class to handle the build context in the dataset creation process."""
|
|
24
|
-
|
|
25
|
-
def __init__(self) -> None:
|
|
26
|
-
"""Initializes a Context instance."""
|
|
27
|
-
# used_references is a set of reference paths that will be needed
|
|
28
|
-
self.used_references = set()
|
|
29
|
-
# results is a dictionary of reference path -> obj
|
|
30
|
-
self.results = {}
|
|
31
|
-
|
|
32
|
-
def will_need_reference(self, key: list | tuple) -> None:
|
|
33
|
-
"""Marks a reference as needed.
|
|
34
|
-
|
|
35
|
-
Parameters
|
|
36
|
-
----------
|
|
37
|
-
key : Union[List, Tuple]
|
|
38
|
-
The reference key.
|
|
39
|
-
"""
|
|
40
|
-
assert isinstance(key, (list, tuple)), key
|
|
41
|
-
key = tuple(key)
|
|
42
|
-
self.used_references.add(key)
|
|
43
|
-
|
|
44
|
-
def notify_result(self, key: list | tuple, result: Any) -> None:
|
|
45
|
-
"""Notifies that a result is available for a reference.
|
|
46
|
-
|
|
47
|
-
Parameters
|
|
48
|
-
----------
|
|
49
|
-
key : Union[List, Tuple]
|
|
50
|
-
The reference key.
|
|
51
|
-
result : Any
|
|
52
|
-
The result object.
|
|
53
|
-
"""
|
|
54
|
-
trace(
|
|
55
|
-
"🎯",
|
|
56
|
-
step(key),
|
|
57
|
-
"notify result",
|
|
58
|
-
textwrap.shorten(repr(result).replace(",", ", "), width=40),
|
|
59
|
-
plural(len(result), "field"),
|
|
60
|
-
)
|
|
61
|
-
assert isinstance(key, (list, tuple)), key
|
|
62
|
-
key = tuple(key)
|
|
63
|
-
if key in self.used_references:
|
|
64
|
-
if key in self.results:
|
|
65
|
-
raise ValueError(f"Duplicate result {key}")
|
|
66
|
-
self.results[key] = result
|
|
67
|
-
|
|
68
|
-
def get_result(self, key: list | tuple) -> Any:
|
|
69
|
-
"""Retrieves the result for a given reference.
|
|
70
|
-
|
|
71
|
-
Parameters
|
|
72
|
-
----------
|
|
73
|
-
key : Union[List, Tuple]
|
|
74
|
-
The reference key.
|
|
75
|
-
|
|
76
|
-
Returns
|
|
77
|
-
-------
|
|
78
|
-
Any
|
|
79
|
-
The result for the given reference.
|
|
80
|
-
"""
|
|
81
|
-
assert isinstance(key, (list, tuple)), key
|
|
82
|
-
key = tuple(key)
|
|
83
|
-
if key in self.results:
|
|
84
|
-
return self.results[key]
|
|
85
|
-
all_keys = sorted(list(self.results.keys()))
|
|
86
|
-
raise ValueError(f"Cannot find result {key} in {all_keys}")
|