ESMValGroup / ESMValCore

ESMValCore: A community tool for pre-processing data from Earth system models in CMIP and running analysis scripts.
https://www.esmvaltool.org
Apache License 2.0
42 stars 38 forks source link

Use our own unit conversion function in our fixes #2560

Closed schlunma closed 2 weeks ago

schlunma commented 1 month ago

Description

While performing tests for https://github.com/ESMValGroup/ESMValTool/pull/3784, I noticed that our fixes do not use our own unit conversion function, which allows special unit conversions like m -> DU.

This PR adds this, but uses a "safe" version of the unit conversion which will not allow a change of the cube's standard_name (this would lead to errors in the subsequent CMOR checks).

Note: I had to restructure the functions a little bit to avoid circular imports.

Related to

Link to documentation:


Before you get started

Checklist

It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the ๐Ÿ›  Technical or ๐Ÿงช Scientific review.


To help with the number pull requests:

codecov[bot] commented 1 month ago

Codecov Report

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

Project coverage is 94.79%. Comparing base (f622e40) to head (5968487). Report is 9 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2560 +/- ## ========================================== + Coverage 94.77% 94.79% +0.02% ========================================== Files 251 251 Lines 14266 14280 +14 ========================================== + Hits 13520 13537 +17 + Misses 746 743 -3 ```

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

valeriupredoi commented 2 weeks ago

@ESMValGroup/technical-lead-development-team could one of yous please have a last look at this then merge? :beer: