From 7adbcdd7fc7d41033c31693fdbfddd7ca97c8a7a Mon Sep 17 00:00:00 2001 From: Mario Hros <966992+k3a@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:41:04 +0200 Subject: [PATCH] Fix data type when getting a line offset for a segmented hrit_jma --- AUTHORS.md | 1 + satpy/readers/hrit_jma.py | 4 ++-- satpy/tests/reader_tests/test_ahi_hrit.py | 12 ++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index c5f8607c85..0d1e7cf64b 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -37,6 +37,7 @@ The following people have made contributions to this project: - [Gerrit Holl (gerritholl)](https://github.com/gerritholl) - Deutscher Wetterdienst - [David Hoese (djhoese)](https://github.com/djhoese) - [Marc Honnorat (honnorat)](https://github.com/honnorat) +- [Mario Hros (k3a)](https://github.com/k3a) - [Lloyd Hughes (system123)](https://github.com/system123) - [Mikhail Itkin (mitkin)](https://github.com/mitkin) - [Tommy Jasmin (tommyjasmin)](https://github.com/tommyjasmin) diff --git a/satpy/readers/hrit_jma.py b/satpy/readers/hrit_jma.py index ac83776a6a..0266ce945f 100644 --- a/satpy/readers/hrit_jma.py +++ b/satpy/readers/hrit_jma.py @@ -345,8 +345,8 @@ def _get_line_offset(self): if self.is_segmented: # loff in the file specifies the offset of the full disk image # centre (1375/2750 for VIS/IR) - segment_number = self.mda["segment_sequence_number"] - 1 - loff -= (self.mda["total_no_image_segm"] - segment_number - 1) * nlines + segment_number = int(self.mda["segment_sequence_number"]) - 1 + loff -= (int(self.mda["total_no_image_segm"]) - segment_number - 1) * nlines elif self.area_id in (NORTH_HEMIS, SOUTH_HEMIS): # loff in the file specifies the start line of the half disk image # in the full disk image diff --git a/satpy/tests/reader_tests/test_ahi_hrit.py b/satpy/tests/reader_tests/test_ahi_hrit.py index 24e01e6802..ea4afab7f1 100644 --- a/satpy/tests/reader_tests/test_ahi_hrit.py +++ b/satpy/tests/reader_tests/test_ahi_hrit.py @@ -75,8 +75,8 @@ def _get_mda(self, loff=5500.0, coff=5500.0, nlines=11000, ncols=11000, proj_h8 = b"GEOS(140.70) " proj_mtsat2 = b"GEOS(145.00) " proj_name = proj_h8 if platform == "Himawari-8" else proj_mtsat2 - return {"image_segm_seq_no": segno, - "total_no_image_segm": numseg, + return {"image_segm_seq_no": np.uint8(segno), + "total_no_image_segm": np.uint8(numseg), "projection_name": proj_name, "projection_parameters": { "a": 6378169.00, @@ -85,10 +85,10 @@ def _get_mda(self, loff=5500.0, coff=5500.0, nlines=11000, ncols=11000, }, "cfac": 10233128, "lfac": 10233128, - "coff": coff, - "loff": loff, - "number_of_columns": ncols, - "number_of_lines": nlines, + "coff": np.int32(coff), + "loff": np.int32(loff), + "number_of_columns": np.uint16(ncols), + "number_of_lines": np.uint16(nlines), "image_data_function": idf, "image_observation_time": self._get_acq_time(nlines)}