Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cutout slicing of grid dimension #145

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 4 additions & 3 deletions src/anemoi/datasets/data/grids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading