-
Notifications
You must be signed in to change notification settings - Fork 295
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
Add "neutral_resolution_band" kwarg to RatioSharpenedRGB/SelfSharpenedRGB #2489
Conversation
This is also the case for some true/false/natural color RGBs with ABI or MODIS or VIIRS so it is definitely common. However, I don't think I needed to use it because of the ways I was separating the bands in my own processing. I'm OK with this feature if you get the tests passing. Should the value be a list to specify multiple bands? I suppose the only case where that would be needed is if this compositor also supports RGBA generation with 4 bands as inputs. |
Yeah I also did it that way but sometimes I still need this for a quicklook. Well if this compositor can produce RGBA images then the kwarg should be a list. But I haven't found such one so I think I'll leave it for future. For now this is just a minor update. I can't get through the test but it looks like not my fault. It seems other people's PRs also have the same errors.
|
I just merged a PR that fixed the issues with CI. Try rebasing your main with the pytroll main (or merging) and things should start passing. In the future I highly recommend making a new branch specific to the PR you're going to make. Using |
Got it. |
Codecov Report
@@ Coverage Diff @@
## main #2489 +/- ##
=======================================
Coverage 94.84% 94.85%
=======================================
Files 337 337
Lines 49571 49624 +53
=======================================
+ Hits 47016 47069 +53
Misses 2555 2555
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Pull Request Test Coverage Report for Build 5245550960
💛 - Coveralls |
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.
Thanks for putting this together. I had a lot of comments and things I'm unsure of that I commented inline. Another thought I had while reviewing this though is that it takes away from the automatic choosing/handling of the cases where the high resolution band isn't available. So for example in the VIIRS case if you didn't provide the I-band resolution data files then asking for a ratio sharpened true color would just get you the low resolution version. With this neutral resolution functionality, maybe it would be best if there were two optional datasets available: the high resolution band used for ratios and the neutral one used inplace of the low resolution option. Hhhmmm but that makes it ugly in cases where there is no low resolution version of the "neutral" band.
For now I'll post this review that is likely very confusing and I'll have to think about these things offline. The functionality is good, but I think there are cleaner ways to handle some of the logic.
Co-authored-by: David Hoese <david.hoese@ssec.wisc.edu>
Co-authored-by: David Hoese <david.hoese@ssec.wisc.edu>
Well the "neutral" block is completely under "high res", so if you don't give any high res files it will produce a low res image, just like current one. I've updated the examples above so you can see that case. |
pre-commit.ci autofix |
Ready |
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.
I had some questions about some of the tests and one more request on cleaning up the code to make CodeScene a little happier. It also seems like pre-commit wasn't run so pre-commit.ci is complaining about some small things. I can fix those after the other changes are made though.
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
pre-commit.ci autofix |
CI keeps failing in coveralls stage. |
I think coveralls was just having a hard time. I've restarted the jobs and we'll see how things go now. |
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.
I think this looks good to me. Thanks! And thanks for sticking with it with all of the changes I asked for. I'll merge this now, but maybe we should have another PR where we change Satpy's builtins to use this? What existing ones would benefit from this functionality?
Current RatioSharpenedRGB/SelfSharpenedRGB compositor is based on one assumption: there's only one high-res band. However in some composites, like 'false_red_color' of VIIRS, there could be a second high-res band. And it will be wrongfully sharpened in current compositor. So this PR will fix it by adding a new kwarg called "neutral_resolution_band".
Here's a comparison.
The current one
R: I02 -- 375m -- another high-res band (no need for sharpening but still got it)
G: M05/I01 -- 750m/375m -- high-res band (calculate ratio)
B: M04 -- 750m -- low-res band (need sharpening)
(100% enlarged)
(100% enlarged -- I02)
This PR
R: I02 -- 375m -- another high-res band (marked as "neutral_resolution_band" so won't get involved)
G: M05/I01 -- 750m/375m -- high-res band (calculate ratio)
B: M15 -- 750m -- low-res band (need sharpening)
(100% enlarged)
(100% enlarged -- I02)
Additionally, if there's no high-resolution file provided, a non-sharpened, low-res image will come out instead.
R: I02 -- 375m
G: M05 -- 750m
B: M15 -- 750m
Note that "neutral_resolution_band" should be considered as a complementary to "high_resolution_band". So only when the high-resolution file is given and "high_resolution_band" is set, this kwarg takes effect.