Adapt METimage to newer satpy#124
Merged
ninahakansson merged 4 commits intofoua-pps:mainfrom Mar 9, 2026
Merged
Conversation
Satpy 0.60 contains updates to the METimage reader. Sunz correction are no longer done, previously they were done twice.
BengtRydberg
approved these changes
Mar 6, 2026
Contributor
BengtRydberg
left a comment
There was a problem hiding this comment.
LGTM. Added some minor comments.
level1c4pps/__init__.py
Outdated
| if band not in scene: | ||
| continue | ||
| if scene[band].attrs['sun_zenith_angle_correction_applied'] == 'False': | ||
| logger.info(f"Apply sunz correction for {band}") |
Contributor
There was a problem hiding this comment.
probably better to use proper words sun zenith angle than sunz in a log message.
level1c4pps/metimage2pps_lib.py
Outdated
| continue | ||
| print("Is this correct, it was in testdata3.") | ||
| scene[band].attrs['sun_zenith_angle_correction_applied'] = 'True' | ||
| logger.info("Sunz correction not done by satpy reader for versions >= 0.60.") |
Contributor
There was a problem hiding this comment.
Logging for this here looks odd.
If you want to keep the logging , I think it make more sense to move it up to where you check the version and add it in an else statement there, or maybe a comment is enough.
| print("Is this correct, it was in testdata3.") | ||
| scene[band].attrs['sun_zenith_angle_correction_applied'] = 'True' | ||
| logger.info("Sunz correction not done by satpy reader for versions >= 0.60.") | ||
| scene[band].attrs['sun_zenith_angle_correction_applied'] = 'False' |
Contributor
There was a problem hiding this comment.
You could add an argument sunz_applied: bool to this method, as I guess this function is not correct if you use it after apply_sunz_correction is applied, and the comment make more sense in the process_one_scene function.
set_header_and_band_attrs(scn_, orbit_n=orbit_n, sunz_applied=False) # Sunz correction not done by satpy reader for versions >= 0.60.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Satpy 0.60 contains updates to the METimage reader. Sunz correction are no longer done, previously they were done twice. Older versions of satpy should not be used for METimage because of this double sunz correction
pytest level1c4ppsflake8AUTHORS.mdif not there already