Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3347 +/- ##
==========================================
- Coverage 96.34% 96.33% -0.01%
==========================================
Files 463 463
Lines 58959 59048 +89
==========================================
+ Hits 56802 56883 +81
- Misses 2157 2165 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This looks great! This PR adds a special meaning to "standard_name". Does this break backward compatibility? If I understand correctly, loading composites will no longer match by the key in the YAML file, but by the contents of the standard name? We (at least in DWD) currently (ab)use "standard_name" to get a match between a composite and its enhancement. For example, we have many composites with standard name As an example of what we currently use: Is this still loadable as |
pnuu
left a comment
There was a problem hiding this comment.
Some comments inline. I guess the variant loading without defining the variant in any way will need a test where different combinations are defined as options.
|
|
||
| 1. Try each tag in the list, in order, looking for a compositor with matching | ||
| ``standard_name`` and that tag. | ||
| 2. If no tagged variant is found, fall back to the normal name-based lookup. |
There was a problem hiding this comment.
Which variant is used if the tag is not defined in the load and the global env variable is not set and all/some of the following composites are defined?
foo_wmofoo_creflfoo
Each of them have the same standard_name: foo defined, no name is set. Only the first line in the YAML definition is different and for the first two there are tags set.
So what would I get with scn.load(["foo"]) call in the following cases:
- all variants are defined (I'd expect
foovariant without any tags) - only the two tagged versions are defined
There was a problem hiding this comment.
If tags are not provided, neither at load time or in the configuration, the current behaviour is preserved, ie we will use the name (not standard name) to choose the composite to load.
- you get the composite name "foo"
- crash if you don't provide a tag (at load time or as config).
There was a problem hiding this comment.
So something like this for the first case? I'm not sure how this works, but hopefully it's close enough:
pytest.param(
{"comp1": None, "comp1_wmo": ["wmo"]},
None,
"comp1",
"comp1",
id="use_plain_version_when_no_tag",
),For case 2. the failure might need a completely separate test?
|
|
||
| export SATPY_PREFERRED_COMPOSITE_TAGS=crefl,wmo | ||
|
|
||
| Or as a YAML configuration key: |
There was a problem hiding this comment.
In which config file should this be defined?
There was a problem hiding this comment.
at the top of this file, you have your answer :)
YAML Configuration
YAML files that include these parameters can be in any of the following
locations:
<python environment prefix>/etc/satpy/satpy.yaml<user_config_dir>/satpy.yaml(see below)~/.satpy/satpy.yaml<SATPY_CONFIG_PATH>/satpy.yaml(see :ref:config_path_settingbelow)
There was a problem hiding this comment.
sorry, it was actually in config.rst
There was a problem hiding this comment.
Oh, I didn't even know we had a satpy.yaml config file 😅
|
Good point Gerrit. I think that is actually the only use-case for |
Thanks :)
It is backwards compatible. Names of compositors that do not contain ":" are processed as usual.
We use the same thing at SMHI, and the current behaviour should be unaffected. I agree it's not really clean to use standard_name for this purpose, would be nice if we had a good solution for that. |
This PR introduce a system of tagging for composites, allowing switching preferred variants at load time or by configuration.
For example, having the following config:
We can then load
scn.load(["true_color:crefl"])directly to load "true_color_crefl". Alternatively, we can set the config withSATPY_PREFERRED_COMPOSITE_TAGS=creflso thatscn.load(["true_color"])loads "true_color_crefl" by default.This is needed in order implement WMO RGB recommendations in a backwards- and forwards-compatible manner.
Also, possibility to warn for composites at load time has been added.
Disclaimer: AI was used in the design and implementation of this PR.