Skip to content
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 sunz normalization for viirs_compact #108

Merged
merged 3 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions level1c4pps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ def set_header_and_band_attrs_defaults(scene, BANDNAMES, PPS_TAGNAMES, REFL_BAND
fix_sun_earth_distance_correction_factor(scene, band, irch.attrs['start_time'])
scene[band].attrs['wavelength'] = scene[band].attrs['wavelength'][0:3]
scene[band].attrs['sun_zenith_angle_correction_applied'] = 'False'
if "sunz_corrected" in scene[band].attrs.get('modifiers', []):
scene[band].attrs['sun_zenith_angle_correction_applied'] = 'True'
if idtag in PPS_TAGNAMES_TO_IMAGE_NR:
scene[band].attrs['name'] = PPS_TAGNAMES_TO_IMAGE_NR[idtag]
else:
Expand Down
1 change: 1 addition & 0 deletions level1c4pps/tests/test_viirs2pps.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def setUp(self):
"""Create a test scene."""
viirs2pps.BANDNAMES = ['M05', 'M15']
vis006 = mock.MagicMock(attrs={'name': 'image0',
'modifiers': ("sunz_correction", ),
'wavelength': [1, 2, 3, 'um'],
'id_tag': 'ch_r06'})
ir_108 = mock.MagicMock(attrs={
Expand Down
9 changes: 7 additions & 2 deletions level1c4pps/viirs2pps_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def set_header_and_band_attrs(scene, orbit_n=0):
for band in REFL_BANDS:
if band not in scene:
continue
# For VIIRS data sun_zenith_angle_correction_applied is applied always!
# VIIRS data read with sunz_corrected modifier
scene[band].attrs['sun_zenith_angle_correction_applied'] = 'True'
return nimg

Expand All @@ -140,12 +140,17 @@ def process_one_scene(scene_files, out_path, use_iband_res=False, reader='viirs_
MY_IBAND_I = IBAND_PPS_I
MY_IBAND_M = IBAND_PPS_M

MY_MBAND_REFL = [band for band in MY_MBAND if band in REFL_BANDS]
MY_MBAND_TB = [band for band in MY_MBAND if band not in REFL_BANDS]

if use_iband_res:
scn_.load(MY_IBAND_I + ANGLE_NAMES + ['i_latitude', 'i_longitude'], resolution=371)
scn_.load(MY_IBAND_M, resolution=742)
scn_ = scn_.resample(resampler='native')
elif reader == "viirs_compact":
scn_.load(MY_MBAND + ANGLE_NAMES + ['latitude_m', 'longitude_m'], resolution=742)
scn_.load(MY_MBAND_TB + ANGLE_NAMES + ['latitude_m', 'longitude_m'], resolution=742)
# Load reflective bands with sunz-correction (not the default for VIIRS compact).
scn_.load(MY_MBAND_REFL, modifiers=("sunz_corrected", ))
else:
scn_.load(MY_MBAND + ANGLE_NAMES + ['m_latitude', 'm_longitude'], resolution=742)

Expand Down
Loading