Skip to content

Enable converting fields with UserMetadata into Xarray#701

Merged
sandorkertesz merged 2 commits into
developfrom
feature/usermetadata-to-xarray
May 15, 2025
Merged

Enable converting fields with UserMetadata into Xarray#701
sandorkertesz merged 2 commits into
developfrom
feature/usermetadata-to-xarray

Conversation

@sandorkertesz
Copy link
Copy Markdown
Collaborator

@sandorkertesz sandorkertesz commented May 15, 2025

With this PR the examples below work:

data with geography

import earthkit.data as ekd

prototype = {
        "latitudes": [10.0, 0.0, -10.0],
        "longitudes": [20, 40.0],
        "values": [1, 2, 3, 4, 5, 6],
        "valid_datetime": "2018-08-01T09:00:00Z",
    }

d = [
        {"param": "t", "level": 500, **prototype},
        {"param": "t", "level": 850, **prototype},
        {"param": "u", "level": 500, **prototype},
        {"param": "u", "level": 850, **prototype},
    ]

ds = ekd.from_source("list-of-dicts", d)
a = ds.to_xarray()

data without geography

import earthkit.data as ekd

prototype = {
        "values": [1, 2, 3, 4, 5, 6],
        "valid_datetime": "2018-08-01T09:00:00Z",
    }

d = [
        {"param": "t", "level": 500, **prototype},
        {"param": "t", "level": 850, **prototype},
        {"param": "u", "level": 500, **prototype},
        {"param": "u", "level": 850, **prototype},
    ]

ds = ekd.from_source("list-of-dicts", d)
a = ds.to_xarray()

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.92%. Comparing base (f865858) to head (86e7595).
⚠️ Report is 334 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #701      +/-   ##
===========================================
+ Coverage    90.88%   90.92%   +0.03%     
===========================================
  Files          165      166       +1     
  Lines        12533    12586      +53     
  Branches       612      612              
===========================================
+ Hits         11391    11444      +53     
  Misses         960      960              
  Partials       182      182              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sandorkertesz sandorkertesz merged commit 6077f6d into develop May 15, 2025
122 of 127 checks passed
@sandorkertesz sandorkertesz deleted the feature/usermetadata-to-xarray branch May 15, 2025 17:01
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