Open mraspaud opened 2 years ago
Is there anything mathematically that requires that composites handle this? I think typically this is handled "automatically" by enhancements. The one compositor I can think of that these negatives may play a part is my "RatioSharpeningCompositor" stuff where I take the ratio of two bands (ex. red / low_res_red
) and then multiply the other bands by that ratio. I've updated this compositor in the past to make sure the ratio is never negative so removing the clipping from the readers shouldn't be a problem there.
Mathematically no, but if one band out of three is masked (NaN brightness temperatures) the impact on the colour is much larger than when it's clipped to the lower end of a range.
Mathematically no, but if one band out of three is masked (NaN brightness temperatures) the impact on the colour is much larger than when it's clipped to the lower end of a range.
Only if linear
stretch is used, but yeah, some users (and built-in composites) do that.
The GenericCompositor will "share" the mask between any input bands so you make a very good point @gerritholl. If a negative radiance produces a NaN temperature and is then included in a RGB then it would effect all pixels of the RGB. Maybe it should be up to the IR calibration in a reader to clip the radiances to 0? Hhhmmm but that's still a "esthetic" change rather than a "scientific" requirement.
log-based enhancements won't like this (eg cira-stretch, reinhardt).
@mraspaud They already have to deal with negatives for other readers. And the enhancements are the component that should be dealing with this.
ok. We just have to check that we don't break anything when removing the clipping.
Good point, thanks for raising this! Would clipping remain the default behaviour? Your third point reads like a proposal for generic calibration algorithms in Satpy that users can choose from. That would be great! :slightly_smiling_face:
If radiances can be clipped by the enhancements / composites then I'd strongly push for the default to be no clipping: There's a big risk that research users won't know about this behaviour and will just use the default.
That makes sense, they'll probably notice the negative values and if they don't want them they can enable clipping.
I personally feel like there should be no option for clipping in the readers unless it is scientifically useful/meaningful. Otherwise it is more of an "esthetic" change and should be handled in the RGB composites or enhancements.
I had a quick search through the code and it seems that the following readers do some manner of clipping:
aaap_l1b
(line 548):
channel
(reflectance?) to zero.agri_l1
(line 63):
ahi_hsd
:
goes_imager_hrit
(line 439):
goes_imager_nc
(lines 851, 896, 923):
sar_c_safe
(line 599):
seviri_base
(line 490):
viirs_compact
(line 280):
Thanks for the investigation work @simonrp84 !
Just catched up with the conversation on slack where @simonrp84 mentioned that negative radiances can't be used for anything physical. So I think it would make sense to keep the clipping option. This would be convenient for scientific users who are processing the data in their algorithms.
See also https://github.com/pytroll/satpy/pull/2499 where optional radiance clipping through a config key was implemented by @ghiggi (currently only for abi_l1b)
Feature Request
At the moment, different readers have different behaviours when it comes to clipping or not negative radiances. As this has been pointed out by @simonrp84, it can be desirable to keep the negative radiances for eg sensor noise estimation. Even though different space agency probably recommend different behaviours, it is important that satpy stays consistent in this I think.
This issue is raised to have a place to discuss different aspects of this standardization.
Things to take into consideration:
There are certainly more to think about here, please do comment.