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

Update AHI HSD calibration coefficients #1908

Merged
merged 3 commits into from Dec 7, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions satpy/readers/ahi_hsd.py
Expand Up @@ -249,9 +249,9 @@ class AHIHSDFileHandler(BaseFileHandler):
scene.load([0.6])

The AHI HSD data files contain multiple VIS channel calibration
coefficients. By default, the standard coefficients in header block 5
are used. If the user prefers the updated calibration coefficients then
they can pass calib_mode='update' when creating a scene::
coefficients. By default, the updated coefficients in header block 6
are used. If the user prefers the default calibration coefficients from
block 5 then they can pass calib_mode='nominal' when creating a scene::

import satpy
import glob
Expand Down Expand Up @@ -307,7 +307,7 @@ class AHIHSDFileHandler(BaseFileHandler):
"""

def __init__(self, filename, filename_info, filetype_info,
mask_space=True, calib_mode='nominal',
mask_space=True, calib_mode='update',
user_calibration=None):
"""Initialize the reader."""
super(AHIHSDFileHandler, self).__init__(filename, filename_info,
Expand Down Expand Up @@ -658,7 +658,7 @@ def convert_to_radiance(self, data):
user_slope, user_offset = get_user_calibration_factors(self.band_name,
self.user_calibration)

data = (data * dn_gain + dn_offset).clip(0)
data = (data * dn_gain + dn_offset)
# If using radiance correction factors from GSICS or similar, apply here
if correction_type == 'RAD':
data = apply_rad_correction(data, user_slope, user_offset)
Expand Down
11 changes: 5 additions & 6 deletions satpy/tests/reader_tests/test_ahi_hsd.py
Expand Up @@ -381,7 +381,7 @@ def test_default_calibrate(self, *mocks):

# Radiance
rad_exp = np.array([[15.2, 11.5],
[7.8, 0]])
[7.8, -3.3]])
rad = self.fh.calibrate(data=self.counts,
calibration='radiance')
self.assertTrue(np.allclose(rad, rad_exp))
Expand All @@ -405,7 +405,7 @@ def test_updated_calibrate(self):
# Standard operation
self.fh.calib_mode = 'UPDATE'
rad_exp = np.array([[30.4, 23.0],
[15.6, 0.]])
[15.6, -6.6]])
rad = self.fh.calibrate(data=self.counts, calibration='radiance')
self.assertTrue(np.allclose(rad, rad_exp))

Expand All @@ -427,7 +427,7 @@ def test_updated_calibrate(self):
}
rad = self.fh.calibrate(data=self.counts, calibration='radiance')
rad_exp = np.array([[15.2, 11.5],
[7.8, 0]])
[7.8, -3.3]])
self.assertTrue(np.allclose(rad, rad_exp))

def test_user_calibration(self):
Expand All @@ -438,7 +438,7 @@ def test_user_calibration(self):
self.fh.band_name = 'B13'
rad = self.fh.calibrate(data=self.counts, calibration='radiance').compute()
rad_exp = np.array([[16.10526316, 12.21052632],
[8.31578947, 0.10526316]])
[8.31578947, -3.36842105]])
self.assertTrue(np.allclose(rad, rad_exp))

# This is for DN calibration
Expand All @@ -447,7 +447,6 @@ def test_user_calibration(self):
'type': 'DN'}
self.fh.band_name = 'B13'
rad = self.fh.calibrate(data=self.counts, calibration='radiance').compute()
print(rad)
rad_exp = np.array([[15.2, 12.],
[8.8, 0.]])
[8.8, -0.8]])
self.assertTrue(np.allclose(rad, rad_exp))