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

Fix cutout slicing of grid dimension #145

merged 2 commits into from
Nov 22, 2024

Conversation

japols
Copy link
Member

@japols japols commented Nov 21, 2024

This PR fixes a bug with slicing Cutout datasets where slicing the grid dimension didn't work:

cfg = {
    "cutout": [
        {
            "dataset": "metno-meps-archive-det-opendap-2p5km-2020-2023-6h-v1", 
            "thinning": 25
        },
        {
            "dataset": "aifs-od-an-oper-0001-mars-o96-2016-2023-6h-v6"
        }
    ], "adjust": "all"
}

ds = open_dataset(cfg)
sample = ds[1324:1327, :, :, :]
print(sample.shape)
sample = ds[1324:1327, :, :, 0:20000]
print(sample.shape)

previously gave

(3, 85, 1, 41459)
(3, 85, 1, 41459)

now gives

(3, 85, 1, 41459)
(3, 85, 1, 20000)

@b8raoult @floriankrb @JPXKQX @paulina-t

@codecov-commenter
Copy link

codecov-commenter commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.96%. Comparing base (2c8bd40) to head (3fbe0ed).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #145   +/-   ##
========================================
  Coverage    72.96%   72.96%           
========================================
  Files           10       10           
  Lines          825      825           
========================================
  Hits           602      602           
  Misses         223      223           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@JPXKQX
Copy link
Member

JPXKQX commented Nov 21, 2024

It looks good to me

@JPXKQX JPXKQX requested a review from b8raoult November 21, 2024 18:46
@japols japols self-assigned this Nov 22, 2024
@japols japols merged commit c3b6e0c into develop Nov 22, 2024
54 checks passed
@japols japols deleted the fix/cutout_slicing branch November 22, 2024 12:19
@HCookie HCookie mentioned this pull request Nov 26, 2024
tnipen pushed a commit to metno/anemoi-datasets that referenced this pull request Nov 29, 2024
* fix: cutout slicing of grid dimension
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants