Yet another alternative implementation for working with derived variables#3053
Yet another alternative implementation for working with derived variables#3053bouweandela wants to merge 2 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3053 +/- ##
==========================================
- Coverage 96.15% 96.00% -0.15%
==========================================
Files 270 270
Lines 15805 15844 +39
==========================================
+ Hits 15197 15211 +14
- Misses 608 633 +25 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
schlunma
left a comment
There was a problem hiding this comment.
Thanks Bouwe, looks good! I prefer this approach over #3051. This will certainly be very helpful when using the ESMValCore Python API.
I am not a very big fan of adding a feature to the Dataset class but not using it when parsing recipes, but in this case it's much easier to separate this. Incorporating this cleanly into the existing code was by far the hardest problem I had in #3051.
Will look into this in more detail once the PR is ready for review! Thanks so much!
|
|
||
| def __init__(self, **facets: FacetValue) -> None: | ||
| self.facets: Facets = facets | ||
| self._input_datasets: tuple[Dataset, ...] = () |
There was a problem hiding this comment.
Looks like this is not used anywhere
| standard_name=var_info.standard_name, # type: ignore[union-attr] | ||
| ) | ||
|
|
||
| def from_files(self) -> Iterator[Self]: |
There was a problem hiding this comment.
| def from_files(self) -> Iterator[Self]: | |
| def from_files(self) -> Generator[Self]: |
I think a Generator is more accurate (every Generator is an Iterator, but not vice versa).
Description
Yet another alternative implementation to #2777 and #3051 for finding input datasets for derived variables and loading them. Adds a new class method `esmvalcore.dataset.DerivedDataset that can be used to work with derived variables.
Note that derived variables with optional input datasets are not yet supported. The only derived variable that uses this feature is
amocat the moment, so the impact of that is limited.Link to documentation: https://esmvaltool--3053.org.readthedocs.build/projects/ESMValCore/en/3053/notebooks/derived-variables.html
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: