Skip to content

Adapt METimage to newer satpy#124

Merged
ninahakansson merged 4 commits intofoua-pps:mainfrom
ninahakansson:fix_metimage_for_real_data
Mar 9, 2026
Merged

Adapt METimage to newer satpy#124
ninahakansson merged 4 commits intofoua-pps:mainfrom
ninahakansson:fix_metimage_for_real_data

Conversation

@ninahakansson
Copy link
Collaborator

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

  • Closes #xxxx <!-- remove if there is no corresponding issue
  • Tests added
  • Tests passed: Passes pytest level1c4pps
  • Passes flake8
  • Add your name to AUTHORS.md if not there already

Satpy 0.60 contains updates to the METimage reader.
Sunz correction are no longer done, previously they were done twice.
Copy link
Contributor

@BengtRydberg BengtRydberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Added some minor comments.

if band not in scene:
continue
if scene[band].attrs['sun_zenith_angle_correction_applied'] == 'False':
logger.info(f"Apply sunz correction for {band}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably better to use proper words sun zenith angle than sunz in a log message.

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.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ninahakansson ninahakansson merged commit 44b5f38 into foua-pps:main Mar 9, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants