-
Notifications
You must be signed in to change notification settings - Fork 300
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
Fix CREFL using incorrect coefficients for MODIS #2084
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2084 +/- ##
==========================================
+ Coverage 93.86% 93.89% +0.02%
==========================================
Files 283 283
Lines 42379 42500 +121
==========================================
+ Hits 39781 39905 +124
+ Misses 2598 2595 -3
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.
Good that the coeffs are not mixed up anymore. However, we should have a nicer way to handle the coefficients for the different sensors. Hardcoded index offsets ?!?
Not directly related to this PR itself, but is there some documentation / a paper / something that describes CREFL that we can add to the docstring? Would be good to have something more insightful than "Ralph did it" if possible ;-) |
@simonrp84 The CREFL software is the NASA MODIS CREFL package: And the NASA VIIRS CVIIRS SPA software (link requires login so not copying here). The stuff by Ralph is nothing official as far as I know. @ralphk11 can comment. I'm not sure if it has been published. I can, should, and will document more about this being from the NASA algorithms. As far as you question on slack:
Ralph said this about the changes as a whole:
|
@mraspaud I've refactored the parts of the code I could. I wanted to avoid passing instance methods to @simonrp84 @ralphk11 I've added more information to the docstring including linking to the NASA DRL pages for CREFL and CVIIRS. This whole module has an |
For reference the original CREFL code is similar to what is described in appendix A1 (page 74) of the ATBD for the MODIS MOD04/MYD04 data product. Note that for some reason the linked filename says MOD02(??) https://modis.gsfc.nasa.gov/data/atbd/atbd_mod02.pdf. The AHI/ABI implementation is based on the MODIS collection 6 algorithm, where a spherical-shell atmosphere was assumed rather than a plane-parallel. See appendix A in: "The Collection 6 MODIS aerosol products over land and ocean" Atmos. Meas. Tech., 6, 2989–3034, 2013 www.atmos-meas-tech.net/6/2989/2013/ doi:10.5194/amt-6-2989-2013 |
Added. Thanks @ralphk11 |
Unstable environment failures are from this PR in xarray which should be fixed shortly (hopefully): pydata/xarray#6471 |
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 the refactoring, it looks definitely better. We could surely go further with it, but that could be in another future PR if you don't feel like going further on this right now. I have one comment inline which I think needs addressing, and then there are quite a few places where coverage is allegedly missing...
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 few comments.
Surprisingly the precision differences between my system and CI seems decent (1e-6). I've updated the tests to be a little friendly. |
Whoa, updated locally and it looks like I'm seeing similar failures. A new version of numpy or something must be changing results. |
I just pushed a small commit that removed the |
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!
While working on some Polar2Grid 3.0 validation and comparison, I noticed that the MODIS true_color composites with CREFL rayleigh correction looked different than in past versions. The past versions use the official C version of the CREFL/CVIIRS code. After some debugging it was clear the Satpy CREFL implementation was different. What was used in Satpy was only the VIIRS and ABI coefficients worked on by @ralphk11. The other coefficients needed for MODIS were hidden behind a global
if
statement.I think this PR fixes everything I was concerned about. It is a little uglier than I was hoping for now that I have to pass
sensor_name
further into the atmosphere code, but the alternative was some duplicated code. I'm satisfied that the MODIS tests are the only ones that needed modification.CC @wroberts4 who originally tried to merge all of the crefl algorithms together.
Edit: To clarify, the MODIS processing was incorrectly using VIIRS coefficients and code paths rather than the official MODIS ones.