Skip to content

Commit c3b6e0c

Browse files
authored
Fix cutout slicing of grid dimension (#145)
* fix: cutout slicing of grid dimension
1 parent 2c8bd40 commit c3b6e0c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ Keep it human-readable, your future self will thank you!
1010

1111
## [Unreleased](https://github.com/ecmwf/anemoi-datasets/compare/0.5.8...HEAD)
1212

13+
## Changed
14+
15+
- Fix metadata serialization handling of numpy.integer (#140)
16+
- Fix cutout slicing of grid dimension (#145)
1317

1418
### Added
1519

1620
- Call filters from anemoi-transform
1721
- make test optional when adls is not installed Pull request #110
18-
- Bugfix for numpy ints in metadata
19-
2022

2123
## [0.5.8](https://github.com/ecmwf/anemoi-datasets/compare/0.5.7...0.5.8) - 2024-10-26
2224

src/anemoi/datasets/data/grids.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,15 @@ def _get_tuple(self, index):
289289
"""
290290
index, changes = index_to_slices(index, self.shape)
291291
# 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]
293293

294294
# First apply spatial indexing on `self.globe` and then apply the mask
295295
globe_data_sliced = self.globe[index[:3]]
296296
globe_data = globe_data_sliced[..., self.global_mask]
297297

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+
300301
return apply_index_to_slices_changes(result, changes)
301302

302303
def collect_supporting_arrays(self, collected, *path):

0 commit comments

Comments
 (0)