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 sel for xarray created from single field #564

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

sandorkertesz
Copy link
Collaborator

@sandorkertesz sandorkertesz commented Dec 10, 2024

Fixes #554

This PR fixes the issue when sel() did not work on Xarray created from a single GRIB field with the "earthkit" Xarray engine.

E.g. the following code previously failed when calling sel():

import earthkit.data
ds = earthkit.data.from_source("ecmwf-open-data",
source='aws',
model='ifs',
param=["2t"],
step=[24],
)
ds_xr_earthkit = ds.to_xarray()
ds_xr_earthkit['2t'].sel(latitude=35, longitude=-90, method='nearest').values

Now it produces the correct output:

array([281.03421021])

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.13%. Comparing base (ed78a5f) to head (6e0bcdf).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #564   +/-   ##
========================================
  Coverage    90.12%   90.13%           
========================================
  Files          149      149           
  Lines        10950    10960   +10     
  Branches       518      518           
========================================
+ Hits          9869     9879   +10     
  Misses         914      914           
  Partials       167      167           

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

@sandorkertesz sandorkertesz merged commit 0136fad into develop Dec 10, 2024
107 checks passed
@sandorkertesz sandorkertesz deleted the bugfix/single-field-xarray-sel branch December 10, 2024 11:51
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.

2 participants