Add float to FacetValue and improve preprocessor filename template error message#2931
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (92.85%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #2931 +/- ##
=======================================
Coverage 95.59% 95.59%
=======================================
Files 266 266
Lines 15559 15569 +10
=======================================
+ Hits 14873 14883 +10
Misses 686 686 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| from iris.cube import Cube | ||
|
|
||
| FacetValue = str | Sequence[str] | int | ||
| FacetValue = str | Sequence[str] | int | float |
There was a problem hiding this comment.
I'm not sure how to test this code
There was a problem hiding this comment.
you can't - it's literally a typing declaration, they should be excluded from testing
| f"for {dataset}, facet values have invalid type: " | ||
| + ", ".join( | ||
| f"'{f}: {dataset.facets[f]}' has type {type(dataset.facets[f]).__name__}" | ||
| for f in sorted(wrong_type_facets) |
There was a problem hiding this comment.
may not want to sort so that the user knows what order those wrong facets came in
There was a problem hiding this comment.
The way the facets arrive in a particular order isn't very transparent to users, so I'm not convinced we should put effort in preserving it. I expect it's something like the order from the recipe, depending on the project some facets may be added from the CMOR table and CV and then extra facets if they're defined.
|
Thanks for reviewing! |
Description
Add
floattoesmvalcore.typing.FacetValueand improve the error message when an error occurs creating a preprocessor filename from the template.This is needed because some of the OBS/OBS6 datasets use a
floatas aversionnumber and I hadn't realized that facet values could be floats when switchingesmvalcore.typing.FacetValuefromnumber.Numbertointin https://github.com/ESMValGroup/ESMValCore/pull/2765/files#diff-09172b6abd0ac8654c50bab112192d3675ce773a649573a39d8ae9759866c184 because of python/mypy#3186.Fixes part of ESMValGroup/ESMValTool#4293
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: