From e52bc1239773545c8deb700707ffdd35d6dbdbe8 Mon Sep 17 00:00:00 2001 From: japols Date: Thu, 21 Nov 2024 16:22:13 +0000 Subject: [PATCH 1/2] fix: fix cutout slicing of grid dimension --- src/anemoi/datasets/data/grids.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/anemoi/datasets/data/grids.py b/src/anemoi/datasets/data/grids.py index fd574136..df5ed4b2 100644 --- a/src/anemoi/datasets/data/grids.py +++ b/src/anemoi/datasets/data/grids.py @@ -289,14 +289,15 @@ def _get_tuple(self, index): """ index, changes = index_to_slices(index, self.shape) # Select data from each LAM - lam_data = [lam[index] for lam in self.lams] + lam_data = [lam[index[:3]] for lam in self.lams] # First apply spatial indexing on `self.globe` and then apply the mask globe_data_sliced = self.globe[index[:3]] globe_data = globe_data_sliced[..., self.global_mask] - # Concatenate LAM data with global data - result = np.concatenate(lam_data + [globe_data], axis=self.axis) + # Concatenate LAM data with global data, apply the grid slicing + result = np.concatenate(lam_data + [globe_data], axis=self.axis)[..., index[3]] + return apply_index_to_slices_changes(result, changes) def collect_supporting_arrays(self, collected, *path): From 3fbe0edd47e42227316de6299a5538e63cebaf73 Mon Sep 17 00:00:00 2001 From: japols Date: Fri, 22 Nov 2024 11:09:31 +0000 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ec7e424..4acca083 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,13 +10,15 @@ Keep it human-readable, your future self will thank you! ## [Unreleased](https://github.com/ecmwf/anemoi-datasets/compare/0.5.8...HEAD) +## Changed + +- Fix metadata serialization handling of numpy.integer (#140) +- Fix cutout slicing of grid dimension (#145) ### Added - Call filters from anemoi-transform - make test optional when adls is not installed Pull request #110 -- Bugfix for numpy ints in metadata - ## [0.5.8](https://github.com/ecmwf/anemoi-datasets/compare/0.5.7...0.5.8) - 2024-10-26