Separate "sensor" attribute concerns#3381
Conversation
|
Without looking at the code here is my gut reaction:
I like your point about there being two uses for the metadata, but I'd like to propose an alternative: Could we have a instrument(s) "serialization" function that converts sensor names/sets to a single "canonical" string version. This could, maybe, even be a configurable thing like "-".join(inst_name.replace("-", "").replace("/", "").lower() for inst_name in instruments)Or something like that. If we break down where satpy-style sensor names are used we have:
The first two seem pretty simple as a "convert instruments to something useful" but it does bring up the issue that there isn't an obvious name for the YAML filenames when users create them. It isn't an exact mapping from something in the .attrs to the YAML filename. For the output filename, it may be as simple as documenting additional keys that can be used that are dynamically generated. I think the benefit of this style of approach is that each use of the instrument information has control over how it is used. For example, whether to join multiple sensors into a single string ( |
|
Another use of sensor I think is in some of the "finding readers" code where a user can specify what sensor they want to read data for and Satpy's utility functions will find all the readers that say they support that sensor. I'm not sure if this functionality is still supported or if it is even useful to keep supporting it. |
Good point, it's the same information in two different spellings
Yes! I like that very much. Just to double check that I understand correctly:
Is that what you had in mind? |
|
Yes, I think that's what I had in mind. We may want the serialization function to be internal and not configurable to start OR define a separate function for each use type: yaml filename serialization versus output filename or something similar. Or it could be defined as a "serialization function" but then the output filename doesn't use that publicly, but more like the output filenaming has various options available (joined versus first with or without lowercasing, etc). Much of that is probably customizable by the user just with plain python string formatting syntax, especially if we always do |
|
Next try -> #3382 |
This is an alternative approach to #3291 . I realized that the "sensor" attribute currently serves two purposes
So I tried separating those two concerns by
sensorattribute to_satpy_sensor. This is still lowercase but for internal usage in filenames and yaml definitions I actually find that more appropriate.instrumentsattribute with the WMO names. Currently ABI L1B only for testing purpose.legacy_sensor_attributeto get thesensorattribute back. At the moment this is True, with v1.0 we could set it to False.Notes:
instrumentsattribute is of typeset, because a dataset can be derived from multiple instruments._satpy_sensorattribute is of typeset|str. Some parts of Satpy take that into account, others just assume it's a string. The advantage of this approach is, that we can leave the internal handling as it is, while the new attribute still draws the users' attention that it might be more than one instrument.Questions:
Scene.__getitem__or are there other paths that I missed here?AUTHORS.mdif not there already