-
Notifications
You must be signed in to change notification settings - Fork 298
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
Refactor code for solar zenith angle correction modifiers #2955
Comments
I would be happy to work on this at some point, but it won't be immediately. Hence, I'm happy to get feedback from others before I would start. |
I like the idea of the refactoring! I'm just wondering how that will affect the DataIDs we use in satpy, where we now describe the modifications to a band with a list of strings... |
@mraspaud you mean when we do something like this: in that case I don't think anything would change since my understanding is that these strings point to predefined modifiers in e.g. |
@strandgren you didn't missunderstand, it was exactly what I was wondering. Thanks for refreshing my memory, I see there won't be any problem on that side then. |
Seems reasonable to me. Option 2 makes sense. |
Feature Request
Is your feature request related to a problem? Please describe.
Satpy includes two methods for solar zenith angle correction of VIS/NIR data:
1/cos_zen
correction: https://github.com/pytroll/satpy/blob/main/satpy/modifiers/angles.py#L534The overall code in these methods is in principle identical with only minor differences, namely the computation of the correction
corr
:1/cos_zen
vs24.35 / (2. * cos_zen + np.sqrt(498.5225 * cos_zen**2 + 1))
. The same applies to the corresponding modifier classes:
My impression is that having two modifiers with separate code that do very similar things can lead to confusion regarding the actual differences. Hence I would propose some refactoring work
Describe the solution you'd like
Alternative 1:
As a first alternative I propose to do a "light" refactoring of the the actual code for the sunz correction and merge the methods used for the sunz correction and instead pass a
method
keyword, e.g.standard
orli_shibata
.It could look something like this:
Alternative 2
The second alternative, and my preference, is to do the above but also remove the
EffectiveSolarPathLengthCorrector
modifier class completely and instead pass themethod
keyword already inSunZenithCorrector
. This would in my opinion be the cleanest and most transparent solution, but we'd need to have a deprecation warning for a few of releases.Describe any changes to existing user workflow
Alternative 1: None.
Alternative 2:
modifiers using the
EffectiveSolarPathLengthCorrector
class would have to change fromto
Additional context
Furthermore the reduction functionality of both sunz correction methods has similarities with the reduction applied in the
SunZenithReducer
modifier here: https://github.com/pytroll/satpy/blob/main/satpy/modifiers/angles.py#L576. Hence, I would also consider refactoring this part of the code and perhaps integrate theSunZenithReducer
modifier in the refactoredSunZenithCorrector
class (TBD depending on final readability and transparency of the code).The text was updated successfully, but these errors were encountered: