New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure RGBs do not have units attributes. #2068
Conversation
For the VIIRS composites unit tests, refactor common code into fixtures.
Add a unit test for the snow age RGB. This unit test currently fails, because it confirms, among other things, that there there is no units attribute present. Also add a reference to the snow age publication.
Add a test to confirm that RGBs produced by the RatioSharpenedRGB have no units attribute.
In the SnowAge and RatioSharpened compositors, clear the units attribute after the RGB has been produced.
I don't see how the test failures are related to anything I did. The tests, including pre-commit linting tests, pass on my local machine, and the failures in GitHub CI are in an entirely different part of the codebase. |
Don't all of these composites use the GenericCompositor? I think, despite the name being misleading, that class is used for all multi-band image products including the DNB compositors, right? Could this unit pop be done in that compositor or is that too dangerous? |
They do use the
and the ones in
The ones in One class I'm not sure about here is the NB: I'm not sure why One other alternative would be that |
Plainly because it handles all the different modes. I'm more surprised that not all compositors use it as the base. |
The main reason not to use GenericCompositor as the base is for those cases where the composite is not an "image" and is meant to represent some kind of realistic data observation or manipulation (temperature differences, etc). @gerritholl Ok, so it seems we have cases where units on an L image may make sense (at least until the composite is enhanced). I'm ok with doing the individual pops in the specific compositors, but there are probably other composites that will still have units if they consist of bands of the same type. I think |
Perhaps. It's not so easy to be sure, without comprehensively covering all composites, for which I would need data I don't have. Most unit tests don't identify the issue, because they don't add a |
I could do the popping in |
I say we wait for @mraspaud to get back and see if he or other @pytroll/satpy-core maintainers have an opinion. This almost sounds like we need another compositor class to handle the Masking for image-like data versus band-like data. Or maybe there is a keyword argument or instance attribute or class attribute that controls the behavior of the "metadata filtering" and when it is applied. |
What can/should I do about
Do we need to split the whole module into multiple modules? The test methods are already factored into classes, so I'm not sure what further module-level refactoring to do. I've only added one method to a class that had 8 methods, now 9. That does not seem excessive. |
I think overall we need to get composites out of |
Can we defer that to a later PR? |
I'd be ok with that. |
Codecov Report
@@ Coverage Diff @@
## main #2068 +/- ##
==========================================
+ Coverage 93.79% 93.84% +0.04%
==========================================
Files 283 283
Lines 42284 42276 -8
==========================================
+ Hits 39662 39672 +10
+ Misses 2622 2604 -18
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I agree that we should think of better organisation of composites, but that they should be in another PR. Merging this one now. |
As per the discussion in #2066, make sure that RGBs do not have units attributes.
Also in this PR:
Refactor VIIRS unit tests
Add unit test for VIIRS snow age RGB
Add or extend unit tests for false color, natural color, ocean color, true color, and true color crefl, including tests for absence of RGBs
Closes RGBs should never have units, but some do #2066
Tests added
Fully documented
Does not change the
ssec_fog
composite, because the result of theDifferenceCompositor
is still a quantity and should correctly have units.