ecmwf / earthkit-data

A format-agnostic Python interface for geospatial data
Apache License 2.0
47 stars 9 forks source link

Fix repeated use of build_remapping with a patch #412

Closed sandorkertesz closed 5 days ago

sandorkertesz commented 5 days ago

This PR fixes the issue when repeated use of remapping with a patch lost the original remapping. Now this works as expected and in the following code r1 and r2 define the same remapping (and patches).

from earthkit.data.core.order import build_remapping
remapping = {"type": "{type}{number}"}
patch = {"type": {"cf0": "x"}}
r1 = build_remapping(remapping, patch)
r2 = build_remapping(r1)

This PR also adds tests for using remapping and patches.

codecov-commenter commented 5 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 89.96%. Comparing base (4973af9) to head (024f32b).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #412 +/- ## =========================================== + Coverage 89.92% 89.96% +0.03% =========================================== Files 120 121 +1 Lines 7764 7794 +30 Branches 675 679 +4 =========================================== + Hits 6982 7012 +30 Misses 651 651 Partials 131 131 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.