Skip to content

Commit

Permalink
Merge pull request pytroll#2655 from mraspaud/fix-eps-radiance
Browse files Browse the repository at this point in the history
  • Loading branch information
mraspaud authored Dec 1, 2023
2 parents e338294 + 9c9ae08 commit 25786b6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 4 additions & 3 deletions satpy/readers/eps_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def read_records(filename):
grh = np.fromfile(fdes, grh_dtype, 1)
if grh.size == 0:
break
rec_class = record_class[int(grh["record_class"])]
rec_class = record_class[int(grh["record_class"].squeeze())]
sub_class = grh["RECORD_SUBCLASS"][0]

expected_size = int(grh["RECORD_SIZE"])
expected_size = int(grh["RECORD_SIZE"].squeeze())
bare_size = expected_size - grh_dtype.itemsize
try:
the_type = form.dtype((rec_class, sub_class))
Expand Down Expand Up @@ -144,7 +144,8 @@ class EPSAVHRRFile(BaseFileHandler):
sensors = {"AVHR": "avhrr-3"}

units = {"reflectance": "%",
"brightness_temperature": "K"}
"brightness_temperature": "K",
"radiance": "W m^-2 sr^-1"}

def __init__(self, filename, filename_info, filetype_info):
"""Initialize FileHandler."""
Expand Down
11 changes: 11 additions & 0 deletions satpy/tests/reader_tests/test_eps_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ def test_dataset(self):
assert res.attrs["calibration"] == "brightness_temperature"
assert res.attrs["units"] == "K"

def test_get_dataset_radiance(self):
"""Test loading a data array with radiance calibration."""
did = make_dataid(name="1", calibration="radiance")
res = self.fh.get_dataset(did, {})
assert isinstance(res, xr.DataArray)
assert res.attrs["platform_name"] == "Metop-C"
assert res.attrs["sensor"] == "avhrr-3"
assert res.attrs["name"] == "1"
assert res.attrs["calibration"] == "radiance"
assert res.attrs["units"] == "W m^-2 sr^-1"

def test_navigation(self):
"""Test the navigation."""
did = make_dataid(name="longitude")
Expand Down

0 comments on commit 25786b6

Please sign in to comment.