From 4d88d41a75c69450d285ab066b4a2ddacf2e89a6 Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" Date: Mon, 13 Jun 2022 10:15:11 +0200 Subject: [PATCH] Handle negative slope2 the same way for all visible channels AAPP treat all visible channels the same --- satpy/readers/aapp_l1b.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/satpy/readers/aapp_l1b.py b/satpy/readers/aapp_l1b.py index 9c3467ec78..ea3877e48a 100644 --- a/satpy/readers/aapp_l1b.py +++ b/satpy/readers/aapp_l1b.py @@ -593,15 +593,14 @@ def _vis_calibrate(data, intercept2 = da.from_array(data["calvis"][:, chn, coeff_idx, 3], chunks=line_chunks) * 1e-7 - if chn == 1 or chn == 2: - # In the level 1b file, the visible coefficients are stored as 4-byte integers. Scaling factors then convert - # them to real numbers which are applied to the measured counts. The coefficient is different depending on - # whether the counts are less than or greater than the high-gain/low-gain transition value (nominally 500). - # The slope for visible channels should always be positive (reflectance increases with count). With the - # pre-launch coefficients the channel 2 slope is always positive but with the operational coefs the stored - # number in the high-reflectance regime overflows the maximum 2147483647, i.e. it is negative when - # interpreted as a signed integer. So you have to modify it. - slope2 = da.where(slope2 < 0, slope2 + 0.4294967296, slope2) + # In the level 1b file, the visible coefficients are stored as 4-byte integers. Scaling factors then convert + # them to real numbers which are applied to the measured counts. The coefficient is different depending on + # whether the counts are less than or greater than the high-gain/low-gain transition value (nominally 500). + # The slope for visible channels should always be positive (reflectance increases with count). With the + # pre-launch coefficients the channel 2, 3a slope is always positive but with the operational coefs the stored + # number in the high-reflectance regime overflows the maximum 2147483647, i.e. it is negative when + # interpreted as a signed integer. So you have to modify it. Also chanel 1 is treated the same way in AAPP. + slope2 = da.where(slope2 < 0, slope2 + 0.4294967296, slope2) channel = da.where(channel <= intersection[:, None], channel * slope1[:, None] + intercept1[:, None],