anemoi-datasets 0.5.11__py3-none-any.whl → 0.5.12__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.
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.5.11'
16
- __version_tuple__ = version_tuple = (0, 5, 11)
15
+ __version__ = version = '0.5.12'
16
+ __version_tuple__ = version_tuple = (0, 5, 12)
@@ -15,6 +15,7 @@ import pprint
15
15
  import warnings
16
16
  from functools import cached_property
17
17
 
18
+ import numpy as np
18
19
  from anemoi.utils.dates import frequency_to_seconds
19
20
  from anemoi.utils.dates import frequency_to_string
20
21
  from anemoi.utils.dates import frequency_to_timedelta
@@ -42,6 +43,9 @@ def _tidy(v):
42
43
  if isinstance(v, slice):
43
44
  return (v.start, v.stop, v.step)
44
45
 
46
+ if isinstance(v, np.integer):
47
+ return int(v)
48
+
45
49
  return v
46
50
 
47
51
 
@@ -241,7 +245,8 @@ class Dataset:
241
245
  if not isinstance(vars, (list, tuple, set)):
242
246
  vars = [vars]
243
247
 
244
- assert set(vars) <= set(self.name_to_index)
248
+ if not set(vars) <= set(self.name_to_index):
249
+ raise ValueError(f"drop: unknown variables: {set(vars) - set(self.name_to_index)}")
245
250
 
246
251
  return sorted([v for k, v in self.name_to_index.items() if k not in vars])
247
252
 
@@ -289,14 +289,15 @@ class Cutout(GridsBase):
289
289
  """
290
290
  index, changes = index_to_slices(index, self.shape)
291
291
  # Select data from each LAM
292
- lam_data = [lam[index] for lam in self.lams]
292
+ lam_data = [lam[index[:3]] for lam in self.lams]
293
293
 
294
294
  # First apply spatial indexing on `self.globe` and then apply the mask
295
295
  globe_data_sliced = self.globe[index[:3]]
296
296
  globe_data = globe_data_sliced[..., self.global_mask]
297
297
 
298
- # Concatenate LAM data with global data
299
- result = np.concatenate(lam_data + [globe_data], axis=self.axis)
298
+ # Concatenate LAM data with global data, apply the grid slicing
299
+ result = np.concatenate(lam_data + [globe_data], axis=self.axis)[..., index[3]]
300
+
300
301
  return apply_index_to_slices_changes(result, changes)
301
302
 
302
303
  def collect_supporting_arrays(self, collected, *path):
@@ -324,7 +325,8 @@ class Cutout(GridsBase):
324
325
  """
325
326
  shapes = [np.sum(mask) for mask in self.masks]
326
327
  global_shape = np.sum(self.global_mask)
327
- return tuple(self.lams[0].shape[:-1] + (sum(shapes) + global_shape,))
328
+ total_shape = sum(shapes) + global_shape
329
+ return tuple(self.lams[0].shape[:-1] + (int(total_shape),))
328
330
 
329
331
  def check_same_resolution(self, d1, d2):
330
332
  # Turned off because we are combining different resolutions
@@ -124,7 +124,14 @@ class Join(Combined):
124
124
  if v in md:
125
125
  result[v] = md[v]
126
126
 
127
- assert len(result) == len(variables), (result, variables)
127
+ if len(result) != len(variables):
128
+ LOG.error("Some variables are missing metadata.")
129
+ for v in variables:
130
+ if v not in result:
131
+ LOG.error("Missing metadata for %r.", v)
132
+
133
+ raise ValueError("Some variables are missing metadata.")
134
+
128
135
  return result
129
136
 
130
137
  @cached_property
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: anemoi-datasets
3
- Version: 0.5.11
3
+ Version: 0.5.12
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
- License: Apache License
6
+ License: Apache License
7
7
  Version 2.0, January 2004
8
8
  http://www.apache.org/licenses/
9
9
 
@@ -224,40 +224,39 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
224
224
  Classifier: Programming Language :: Python :: Implementation :: PyPy
225
225
  Requires-Python: >=3.9
226
226
  License-File: LICENSE
227
- Requires-Dist: anemoi-transform >=0.1
228
- Requires-Dist: anemoi-utils[provenance] >=0.4.9
227
+ Requires-Dist: anemoi-transform>=0.1
228
+ Requires-Dist: anemoi-utils[provenance]>=0.4.9
229
229
  Requires-Dist: cfunits
230
230
  Requires-Dist: numpy
231
231
  Requires-Dist: pyyaml
232
232
  Requires-Dist: semantic-version
233
233
  Requires-Dist: tqdm
234
- Requires-Dist: zarr <=2.17
234
+ Requires-Dist: zarr<=2.17
235
235
  Provides-Extra: all
236
- Requires-Dist: anemoi-datasets[create,remote,xarray] ; extra == 'all'
236
+ Requires-Dist: anemoi-datasets[create,remote,xarray]; extra == "all"
237
237
  Provides-Extra: create
238
- Requires-Dist: earthkit-data[mars] >=0.10.7 ; extra == 'create'
239
- Requires-Dist: earthkit-geo >=0.2 ; extra == 'create'
240
- Requires-Dist: earthkit-meteo ; extra == 'create'
241
- Requires-Dist: eccodes >=2.38.1 ; extra == 'create'
242
- Requires-Dist: entrypoints ; extra == 'create'
243
- Requires-Dist: pyproj ; extra == 'create'
238
+ Requires-Dist: earthkit-data[mars]>=0.10.7; extra == "create"
239
+ Requires-Dist: earthkit-geo>=0.2; extra == "create"
240
+ Requires-Dist: earthkit-meteo; extra == "create"
241
+ Requires-Dist: eccodes>=2.38.1; extra == "create"
242
+ Requires-Dist: entrypoints; extra == "create"
243
+ Requires-Dist: pyproj; extra == "create"
244
244
  Provides-Extra: dev
245
- Requires-Dist: anemoi-datasets[all,docs,tests] ; extra == 'dev'
245
+ Requires-Dist: anemoi-datasets[all,docs,tests]; extra == "dev"
246
246
  Provides-Extra: docs
247
- Requires-Dist: nbsphinx ; extra == 'docs'
248
- Requires-Dist: pandoc ; extra == 'docs'
249
- Requires-Dist: sphinx ; extra == 'docs'
250
- Requires-Dist: sphinx-argparse ; extra == 'docs'
251
- Requires-Dist: sphinx-rtd-theme ; extra == 'docs'
247
+ Requires-Dist: nbsphinx; extra == "docs"
248
+ Requires-Dist: pandoc; extra == "docs"
249
+ Requires-Dist: sphinx; extra == "docs"
250
+ Requires-Dist: sphinx-argparse; extra == "docs"
251
+ Requires-Dist: sphinx-rtd-theme; extra == "docs"
252
252
  Provides-Extra: remote
253
- Requires-Dist: boto3 ; extra == 'remote'
254
- Requires-Dist: requests ; extra == 'remote'
253
+ Requires-Dist: boto3; extra == "remote"
254
+ Requires-Dist: requests; extra == "remote"
255
255
  Provides-Extra: tests
256
- Requires-Dist: pytest ; extra == 'tests'
256
+ Requires-Dist: pytest; extra == "tests"
257
257
  Provides-Extra: xarray
258
- Requires-Dist: gcsfs ; extra == 'xarray'
259
- Requires-Dist: kerchunk ; extra == 'xarray'
260
- Requires-Dist: pandas ; extra == 'xarray'
261
- Requires-Dist: planetary-computer ; extra == 'xarray'
262
- Requires-Dist: pystac-client ; extra == 'xarray'
263
-
258
+ Requires-Dist: gcsfs; extra == "xarray"
259
+ Requires-Dist: kerchunk; extra == "xarray"
260
+ Requires-Dist: pandas; extra == "xarray"
261
+ Requires-Dist: planetary-computer; extra == "xarray"
262
+ Requires-Dist: pystac-client; extra == "xarray"
@@ -1,6 +1,6 @@
1
1
  anemoi/datasets/__init__.py,sha256=0GOHATiKgkUqLRgAVQhNP1aPO7ULfSr8DqUf2ANPEv8,1010
2
2
  anemoi/datasets/__main__.py,sha256=5NW2A3OgTimB4ptwYThivIRSeCrvabMuvnr8mmnVx0E,715
3
- anemoi/datasets/_version.py,sha256=9QMo8Qn8JXkug8VyV8nVyp5woiC_5GOBRXHVqZu_cf4,413
3
+ anemoi/datasets/_version.py,sha256=ZArwdbjC4yDqbe9dEwhZVS693DGl1K3jnRxJy_dutjo,413
4
4
  anemoi/datasets/grids.py,sha256=bq7pB_6uswILT3t8C8SeUpUrBww31dw5au_USrped6c,10919
5
5
  anemoi/datasets/testing.py,sha256=7HGOz5_V9MbkHTDJ4KbklGRndBMrFfVrBBu6a9k0_qY,1825
6
6
  anemoi/datasets/commands/__init__.py,sha256=O5W3yHZywRoAqmRUioAr3zMCh0hGVV18wZYGvc00ioM,698
@@ -90,16 +90,16 @@ anemoi/datasets/create/statistics/__init__.py,sha256=l6VE00sfcfqBg6cDFJTian-DLnv
90
90
  anemoi/datasets/create/statistics/summary.py,sha256=wmnz4fZkr6fomXgI8JlMutU8gakfrXTc5ixf3Np7gZA,3385
91
91
  anemoi/datasets/data/__init__.py,sha256=AW1-Ycj77pWQsZcDGsp0pgTS5rFW6XC4CzuUEIUPAIk,1558
92
92
  anemoi/datasets/data/concat.py,sha256=udtYINuoLOEYYKhi_VpG2-emv80pwZbFAZKwNwXJk3s,5244
93
- anemoi/datasets/data/dataset.py,sha256=rknyaODW9uNSd456139ZUaqTrd59RHUab5nCFWKdSaQ,15414
93
+ anemoi/datasets/data/dataset.py,sha256=73NjQo7wUSWqfdpyVVZIpWgEmy1x9-beN-kVtgfhBJE,15587
94
94
  anemoi/datasets/data/debug.css,sha256=z2X_ZDSnZ9C3pyZPWnQiEyAxuMxUaxJxET4oaCImTAQ,211
95
95
  anemoi/datasets/data/debug.py,sha256=IjCMwtAvknF51PCl_YRYgMZB2iX_9DC5DKILNgl_UHQ,6300
96
96
  anemoi/datasets/data/ensemble.py,sha256=KNIXDfjYSIo6JVn1bD9X92yffd4Gg83wn_2sGxqAnWU,1111
97
97
  anemoi/datasets/data/fill_missing.py,sha256=4btLi-D-hFTsS_57_gIC1nK5AVifAO-V4M-fqMrtrxk,4636
98
98
  anemoi/datasets/data/forwards.py,sha256=P9DfSY5B9w9gtkKfV6TIzXel_LY83g-2nEreJy2rYkU,8916
99
- anemoi/datasets/data/grids.py,sha256=IjR0Ay3AyPm3FSjT4S4-qhcbMpNzdK7jXC8yYhH6Jss,15682
99
+ anemoi/datasets/data/grids.py,sha256=p7_nT7RLH6uKcxeAzQiGYk9lFxU_OOikDrwlb2rdEqI,15765
100
100
  anemoi/datasets/data/indexing.py,sha256=9lycQXSqUIbYj52JlFv0w_Gf6soVZnbVGswYMvGPpqs,4773
101
101
  anemoi/datasets/data/interpolate.py,sha256=D27lSH8yNhm0aoO0U3UoRbr3kni7OWXSu_X4jCbIrA0,4137
102
- anemoi/datasets/data/join.py,sha256=z6mVXJM4On4V2mtniHZGTWtEH4JNGY5czxjH62c_Q7s,5287
102
+ anemoi/datasets/data/join.py,sha256=xl7SrjhggZdX_bdni5-cn8-BYGUYfEtogQeIqCgSL7U,5525
103
103
  anemoi/datasets/data/masked.py,sha256=eAVGVmQR7tWsd3xXYGXGyq28uRLwL50vOXWTNNdHxl0,4530
104
104
  anemoi/datasets/data/merge.py,sha256=6vYRy3-P4J9GgTPkdoPFs9CbZ5F0m8FAukS-P66BR_M,5448
105
105
  anemoi/datasets/data/misc.py,sha256=IKqtvcU36nyB4z6dfu7W_gnCpaeX20fK2C5A2seWdCA,10061
@@ -115,9 +115,9 @@ anemoi/datasets/dates/__init__.py,sha256=wX2FvlmRfHV5HDmllIxwfrC1LuRlb7i6SguLLas
115
115
  anemoi/datasets/dates/groups.py,sha256=i7x8z0kv6E8qUfm1tMZR1aaOqNwQzEkV-VWpOvHjoX4,5390
116
116
  anemoi/datasets/utils/__init__.py,sha256=hCW0QcLHJmE-C1r38P27_ZOvCLNewex5iQEtZqx2ckI,393
117
117
  anemoi/datasets/utils/fields.py,sha256=l7xKOiRLgk9Eewykqu7xZP9xOajG2dx2CiDlGvBVejU,1411
118
- anemoi_datasets-0.5.11.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
119
- anemoi_datasets-0.5.11.dist-info/METADATA,sha256=L4oe7KIUvfomyWOms-zfinIGzjJ41RfwC61wifz_C0E,15593
120
- anemoi_datasets-0.5.11.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
121
- anemoi_datasets-0.5.11.dist-info/entry_points.txt,sha256=yR-o-4uiPEA_GLBL81SkMYnUoxq3CAV3hHulQiRtGG0,66
122
- anemoi_datasets-0.5.11.dist-info/top_level.txt,sha256=DYn8VPs-fNwr7fNH9XIBqeXIwiYYd2E2k5-dUFFqUz0,7
123
- anemoi_datasets-0.5.11.dist-info/RECORD,,
118
+ anemoi_datasets-0.5.12.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
119
+ anemoi_datasets-0.5.12.dist-info/METADATA,sha256=x548Cd_PFUCse1QR5dj-8rNfUx94ZU45g__IjPaGLgY,15598
120
+ anemoi_datasets-0.5.12.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
121
+ anemoi_datasets-0.5.12.dist-info/entry_points.txt,sha256=yR-o-4uiPEA_GLBL81SkMYnUoxq3CAV3hHulQiRtGG0,66
122
+ anemoi_datasets-0.5.12.dist-info/top_level.txt,sha256=DYn8VPs-fNwr7fNH9XIBqeXIwiYYd2E2k5-dUFFqUz0,7
123
+ anemoi_datasets-0.5.12.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.5.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5