-
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 configurable parameters to solar zenith correctors #545
Conversation
Codecov Report
@@ Coverage Diff @@
## master #545 +/- ##
==========================================
+ Coverage 75.97% 76.69% +0.71%
==========================================
Files 136 136
Lines 18810 18961 +151
==========================================
+ Hits 14291 14542 +251
+ Misses 4519 4419 -100
Continue to review full report at Codecov.
|
I made some images with the DayNightCompositor and an ABI true_color and I think this may need to be changed to 92 to get a small transition between the two images. |
Just so it is documented I'm reiterating what was discussed on slack here. @mraspaud and @pnuu thought it would be better for the "night" data to be set to 0 rather than NaNs. This serves my project just as well so I am ok with it. Martin also said that 95 degrees might be the best cutoff. However, the resulting natural color image for this looks...ugly. I am going to try testing gradual dropoffs on the correction so that the data goes to 0 on the edge of the image. I'll have examples later. |
The following natural color images were created with gradual SZA corrections between 88 and 95 degrees. I tried a linear one but it didn't do a good enough job of cutting off the noise in the night data so I'm not including it here. The "Natural Log (before inversion)" code is what is currently committed and what I think looks the best. Due to the angle limits these different methods have little to no effect on the true color images. Square rootSquare root (before inversion)Natural LogNatural Log (before inversion) |
from satpy.composites import SunZenithCorrector | ||
comp = SunZenithCorrector(name='sza_test', modifiers=tuple()) | ||
res = comp((self.ds1,), test_attr='test') | ||
np.testing.assert_allclose(res.values, np.array([[22.401667, 22.31777 ], [22.437503, 22.353533]])) |
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.
E202 whitespace before ']'
from satpy.composites import SunZenithCorrector | ||
comp = SunZenithCorrector(name='sza_test', modifiers=tuple()) | ||
res = comp((self.ds1, self.sza), test_attr='test') | ||
np.testing.assert_allclose(res.values, np.array([[22.401667, 22.31777 ], [22.437503, 22.353533]])) |
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.
E202 whitespace before ']'
# Conflicts: # satpy/composites/__init__.py # satpy/tests/compositor_tests/__init__.py
My favourite is natural log before inversion |
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.
Looks good, just a couple of comments.
I'm not simply a terrible person. Martin and I did discuss this on slack so even though he hasn't officially approved this PR he said it was ok for me to merge this. |
Main Purpose
This PR adds YAML-configurable parameters to the two solar-zenith correctors/modifiers. The three parameters that are now available in both are:
Behavior Change
Currently, this PR has changed the default values for these parameters based on some tests I did with ABI natural_color and true_color RGBs. Previously, the equivalent value for
max_sza
wasNone
due to some undesired (in my opinion) usage of the fill values in the correction code. The way the corrections were previously set up is that for data past 88 degrees a constant correction is applied to the data regardless of SZA. So for SZA 0 to 88 the correction was applied normally, for 88-90+ a constant correction was being applied, even if SZA was NaN. In this PR I've changed it to be corrected from 0 to 88, constant from 88-90 (max_sza
), and NaN after that. This allows satpy and the user to say "anything past this SZA isn't useful data". The main reason for this change was due to noticing that ABI natural color RGBs were having night time pixels "corrected", increasing the "useless" data values.Note that the user can get the same behavior as before by specifying
max_sza: !!null
in the YAML for thesunz_corrected
.I am ok not including this behavior change (I'd still like it) because I can have it customized in my own projects (Polar2Grid/Geo2Grid).
Examples
NOTE: The default True Color enhancement sets all negative reflectances to NaN/transparent.
GOES-16 ABI True Color - Old
GOES-16 ABI Natural Color - Old
GOES-16 ABI True Color - 0 to 88 to 90
GOES-16 ABI Natural Color - 0 to 88 to 90
GOES-16 ABI True Color - 0 to 88 to 92
GOES-16 ABI Natural Color - 0 to 88 to 92
GOES-16 ABI True Color - 0 to 88 to 95
Same as 0 to 88 to 92 image.
GOES-16 ABI Natural Color - 0 to 88 to 95
Miscellaneous
I originally started working on this because the natural color image shows bright green and red pixels in the night time data. I was able to prove that negative reflectances were part of the problem and were being made worse by the SZA corrector and by the sharpening code. However, it didn't get rid of all of it and cutting off the SZA correction seemed to make more sense.
git diff origin/master -- "*py" | flake8 --diff