Allow to keep units in composite #2023
Labels
backwards-incompatibility
Causes backwards incompatibility or introduces a deprecation
component:compositors
component:enhancements
component:writers
enhancement
code enhancements, features, improvements
Feature Request
Is your feature request related to a problem? Please describe.
We have single-band "composites" that we use for our IR channels, so that we can apply a crude stretch enhancement. For reference, our enhancement is:
and the composite
Using this composite, we write files that contain temperature units in the header. There are presently wrong; see #2018. We cannot presently use the solution in #2021 (which sets an offset prior to applying any other enhancements), because Satpy helpfully deletes units metadata when constructing the composite:
satpy/satpy/composites/__init__.py
Lines 418 to 422 in 82112a6
With the unit metadata gone by the time we are saving our data file, we cannot safely convert the units between K and °C.
Describe the solution you'd like
I would like that either:
GenericCompositor
retainsunits
(and other) metadata if the compositor has exactly one input, orGenericCompositor
retainsunits
metadata if all inputs have the same units, orGenericCompositor
retainsunits
metadata if explicitly asked for by the user, orDescribe any changes to existing user workflow
Alternatives 1 and 2 may result in composites retaining unit metadata where this is not currently the case. Depending on operations applied, those metadata may not be meaningful. Alternative 3 should not lead to any changes to existing user workflow.
Additional context
We could pass a flag to the writer forcing the temperature conversion without checking. This is a risky alternative, but would not require any changes to the widely used
GenericCompositor
.I am open to other ideas.
The text was updated successfully, but these errors were encountered: