Switch to WMO Instruments#3390
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3390 +/- ##
========================================
Coverage 96.30% 96.31%
========================================
Files 466 468 +2
Lines 59090 59264 +174
========================================
+ Hits 56908 57081 +173
- Misses 2182 2183 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Would it make sense to move those instrument helper methods to a dedicated module |
|
I added the "backwards-incompatibility" label on this PR. Let me know if that isn't accurate. You should rebase this PR on |
djhoese
left a comment
There was a problem hiding this comment.
Looks pretty good. I had a couple questions inline. I think my biggest long term fear after seeing these changes is handling the "sensor" in the enhancement decision tree.
…atpy into wmo-instruments-part1
mraspaud
left a comment
There was a problem hiding this comment.
Wow, that's a big one! But very clean, I like it!
My only concern is instument vs sensor, not in the naming, but rather that it could be confusing, but I understand that it makes things more distinct. So nothing to change there.
|
@martin You mean that there's both Ok so I'm going to merge PRs sfinkens#2 and sfinkens#3 into this one and continue with renaming enhancement/composite files so that they match the WMO name. |
|
How will you handle backwards compatibility with old filenames? Or search for both? |
|
My idea was to create a link from the old filename to the new filename |
|
But what will users do before they have time to transition? |
|
Transition their custom YAMLs I mean |
Hmm, good point. I didn't think of that. Then I'll have so search for both the old and the new name. |
The Plan
This is the first of a series of PRs for switching to WMO instrument names (
AVHRR/1) in user facing places, namely dataset attributes andscene.sensor_names. The internal representation (avhrr-1) remains the same.Furthermore, we agreed to deprecate
sensor: str|set[str]in favor ofinstruments: set[str]. For backwards compatibility, a config switch will be added to get the legacysensorattribute back.instruments.sensorin favor ofinstruments2.1 Enhancements: WMO Instruments Part 2.1: Enhancements sfinkens/satpy#2
2.2 File Handlers: WMO Instruments Part 2.2: File Handlers sfinkens/satpy#3
sensortoinstrumentin all method names and docstrings.I hope this way the changes are less painful to review. PRs 2-4 are relative to this PR, which will be merged into main eventually.
Changes in this PR
satpy._instrumentsmodule containingStrEnumwith all WMO instrument names. Members behave like strings, even in setssensorandinstrumentsare supported, with a deprecation warning forsensor.sensorattribute inscene.__getitem__if it doesn't exist. To be removed in v1.0.instruments_keythat controls which attribute Satpy is using. This is mostly for postponing the file handler changes to the second PR. Current default issensor, will be changed toinstrumentsonce all file handlers provide aninstrumentsattribute, and then removed.Breaking Changes
None so far. For v1.0 we would have to remove compatibility methods and deprecation warnings wrapped in
8< v1.0. Then Satpy wouldn't support thesensorattribute anymore.Notes
It would be nice to have a custom Attributes class with getters and setters for the instrument, but xarray converts it back to plain dicts internally.
AUTHORS.mdif not there already