From b7f07387db2d89b188c861007b874b32ba2b0649 Mon Sep 17 00:00:00 2001 From: Martin Raspaud Date: Wed, 6 Nov 2024 18:40:35 +0100 Subject: [PATCH 1/3] Fix geos proj parameters for insat 3d satellites --- satpy/readers/insat3d_img_l1b_h5.py | 5 ++++- satpy/tests/reader_tests/test_insat3d_img_l1b_h5.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/satpy/readers/insat3d_img_l1b_h5.py b/satpy/readers/insat3d_img_l1b_h5.py index dede8aefcd..0b469863fc 100644 --- a/satpy/readers/insat3d_img_l1b_h5.py +++ b/satpy/readers/insat3d_img_l1b_h5.py @@ -179,7 +179,10 @@ def get_area_def(self, ds_id): #fov = self.datatree.attrs["Field_of_View(degrees)"] fov = 18 cfac = 2 ** 16 / (fov / cols) - lfac = 2 ** 16 / (fov / lines) + + # From reverse engineering metadata from a netcdf file, we discovered + # the lfac is actually the same as cfac, ie dependend on cols, not lines! + lfac = 2 ** 16 / (fov / cols) h = self.datatree.attrs["Observed_Altitude(km)"] * 1000 # WGS 84 diff --git a/satpy/tests/reader_tests/test_insat3d_img_l1b_h5.py b/satpy/tests/reader_tests/test_insat3d_img_l1b_h5.py index 7378078c2a..eb7c17ba9d 100644 --- a/satpy/tests/reader_tests/test_insat3d_img_l1b_h5.py +++ b/satpy/tests/reader_tests/test_insat3d_img_l1b_h5.py @@ -280,6 +280,8 @@ def test_filehandler_returns_area(insat_filehandler): area_def = fh.get_area_def(ds_id) _ = area_def.get_lonlats(chunks=1000) assert subsatellite_longitude == area_def.crs.to_cf()["longitude_of_projection_origin"] + np.testing.assert_allclose(area_def.area_extent, [-5618068.510660236, -5640108.009097205, + 5622075.692194229, 5644115.1906312]) def test_filehandler_has_start_and_end_time(insat_filehandler): From 6643a884703b2aae7ab715ec8c84b16e1d19491e Mon Sep 17 00:00:00 2001 From: Martin Raspaud Date: Wed, 6 Nov 2024 18:47:55 +0100 Subject: [PATCH 2/3] Fix typo --- satpy/readers/insat3d_img_l1b_h5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/satpy/readers/insat3d_img_l1b_h5.py b/satpy/readers/insat3d_img_l1b_h5.py index 0b469863fc..aa54827e79 100644 --- a/satpy/readers/insat3d_img_l1b_h5.py +++ b/satpy/readers/insat3d_img_l1b_h5.py @@ -181,7 +181,7 @@ def get_area_def(self, ds_id): cfac = 2 ** 16 / (fov / cols) # From reverse engineering metadata from a netcdf file, we discovered - # the lfac is actually the same as cfac, ie dependend on cols, not lines! + # the lfac is actually the same as cfac, ie dependent on cols, not lines! lfac = 2 ** 16 / (fov / cols) h = self.datatree.attrs["Observed_Altitude(km)"] * 1000 From aca867c2584d1450dd8ff72addf85ab15ef4acd4 Mon Sep 17 00:00:00 2001 From: Martin Raspaud Date: Thu, 7 Nov 2024 08:32:16 +0100 Subject: [PATCH 3/3] Fix offset --- satpy/readers/insat3d_img_l1b_h5.py | 4 ++-- satpy/tests/reader_tests/test_insat3d_img_l1b_h5.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/satpy/readers/insat3d_img_l1b_h5.py b/satpy/readers/insat3d_img_l1b_h5.py index aa54827e79..29f211f08f 100644 --- a/satpy/readers/insat3d_img_l1b_h5.py +++ b/satpy/readers/insat3d_img_l1b_h5.py @@ -194,8 +194,8 @@ def get_area_def(self, ds_id): pdict = { "cfac": cfac, "lfac": lfac, - "coff": cols / 2, - "loff": lines / 2, + "coff": cols // 2 + 1, + "loff": lines // 2, "ncols": cols, "nlines": lines, "scandir": "N2S", diff --git a/satpy/tests/reader_tests/test_insat3d_img_l1b_h5.py b/satpy/tests/reader_tests/test_insat3d_img_l1b_h5.py index eb7c17ba9d..3b100415a4 100644 --- a/satpy/tests/reader_tests/test_insat3d_img_l1b_h5.py +++ b/satpy/tests/reader_tests/test_insat3d_img_l1b_h5.py @@ -280,8 +280,8 @@ def test_filehandler_returns_area(insat_filehandler): area_def = fh.get_area_def(ds_id) _ = area_def.get_lonlats(chunks=1000) assert subsatellite_longitude == area_def.crs.to_cf()["longitude_of_projection_origin"] - np.testing.assert_allclose(area_def.area_extent, [-5618068.510660236, -5640108.009097205, - 5622075.692194229, 5644115.1906312]) + np.testing.assert_allclose(area_def.area_extent, [-5620072.101427, -5640108.009097, + 5620072.101427, 5644115.190631]) def test_filehandler_has_start_and_end_time(insat_filehandler):