Skip to content

Do not use values array in UserMetadata#681

Merged
sandorkertesz merged 1 commit into
developfrom
feature/list-of-dicts-do-not-use-values-in-metadata
Apr 23, 2025
Merged

Do not use values array in UserMetadata#681
sandorkertesz merged 1 commit into
developfrom
feature/list-of-dicts-do-not-use-values-in-metadata

Conversation

@sandorkertesz
Copy link
Copy Markdown
Collaborator

@sandorkertesz sandorkertesz commented Apr 23, 2025

With this PR:

  • UserMetadata does not require "values" to be present in the input dictionary. Previously, under certain conditions, UserMetadata tried to access the "values" and it caused a crash when they were not available.
  • It is possible to create a fully functional ArrayField with a UserMetadata without passing the values array shape to UserMetadata. E.g:
    vals = np.linspace(0, 1, 10)
    meta = UserMetadata(
        {
            "shortName": "test",
            "longName": "Test",
            "date": 20180801,
            "time": 300,
            "latitudes": np.linspace(-10.0, 10.0, 10),
            "longitudes": np.linspace(20.0, 40.0, 10),
        }
    )

    f = ArrayField(vals, meta)

    f.to_latlon() # this works

See the newly added test: tests/array_fieldlist/test_array_field_usermetadata.py

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.18%. Comparing base (8bc8c25) to head (00c6ecf).
⚠️ Report is 360 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #681      +/-   ##
===========================================
+ Coverage    90.15%   90.18%   +0.02%     
===========================================
  Files          159      160       +1     
  Lines        12181    12217      +36     
  Branches       595      595              
===========================================
+ Hits         10982    11018      +36     
  Misses        1017     1017              
  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 a01151f into develop Apr 23, 2025
125 checks passed
@sandorkertesz sandorkertesz deleted the feature/list-of-dicts-do-not-use-values-in-metadata branch April 23, 2025 14:30
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