Skip to content

Commit

Permalink
Merge pull request #2633 from simonrp84/insaT_upd
Browse files Browse the repository at this point in the history
Update INSAT-3D reader to get satellite location from file
  • Loading branch information
mraspaud committed Nov 28, 2023
2 parents 72e2a71 + 79585f1 commit 28aba2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 9 additions & 2 deletions satpy/readers/insat3d_img_l1b_h5.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,12 @@ def get_area_def(self, ds_id):
lines = shape[-2]
cols = shape[-1]

fov = self.datatree.attrs["Field_of_View(degrees)"]
# From empirical analysis, hardcoding the view of view to 18 degrees
# produces better geolocation results.
# Uncommenting the line below will use the fov from the file instead,
# this line is kept for reference.
#fov = self.datatree.attrs["Field_of_View(degrees)"]
fov = 18
cfac = 2 ** 16 / (fov / cols)
lfac = 2 ** 16 / (fov / lines)

Expand All @@ -182,6 +187,8 @@ def get_area_def(self, ds_id):
a = 6378137.0
b = 6356752.314245

subsatellite_longitude = self.datatree.attrs["Nominal_Central_Point_Coordinates(degrees)_Latitude_Longitude"][1]

pdict = {
"cfac": cfac,
"lfac": lfac,
Expand All @@ -193,7 +200,7 @@ def get_area_def(self, ds_id):
"a": a,
"b": b,
"h": h,
"ssp_lon": 82.0,
"ssp_lon": subsatellite_longitude,
"a_name": "insat3d82",
"a_desc": "insat3d82",
"p_id": "geosmsg"
Expand Down
5 changes: 4 additions & 1 deletion satpy/tests/reader_tests/test_insat3d_img_l1b_h5.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@

start_time = datetime(2009, 6, 9, 9, 0)
end_time = datetime(2009, 6, 9, 9, 30)
subsatellite_longitude = 82

time_pattern = "%d-%b-%YT%H:%M:%S"

global_attrs = {"Observed_Altitude(km)": 35778.490219,
"Field_of_View(degrees)": 17.973925,
"Acquisition_Start_Time": start_time.strftime(time_pattern),
"Acquisition_End_Time": end_time.strftime(time_pattern),
"Nominal_Central_Point_Coordinates(degrees)_Latitude_Longitude": [0.0, 82.0],
"Nominal_Central_Point_Coordinates(degrees)_Latitude_Longitude": [0.0, subsatellite_longitude],
"Nominal_Altitude(km)": 36000.0,
}

Expand Down Expand Up @@ -243,6 +244,7 @@ def test_insat3d_has_orbital_parameters(insat_filehandler):

assert "orbital_parameters" in darr.attrs
assert "satellite_nominal_longitude" in darr.attrs["orbital_parameters"]
assert darr.attrs["orbital_parameters"]["satellite_nominal_longitude"] == subsatellite_longitude
assert "satellite_nominal_latitude" in darr.attrs["orbital_parameters"]
assert "satellite_nominal_altitude" in darr.attrs["orbital_parameters"]
assert "satellite_actual_altitude" in darr.attrs["orbital_parameters"]
Expand Down Expand Up @@ -276,6 +278,7 @@ def test_filehandler_returns_area(insat_filehandler):
ds_id = make_dataid(name="MIR", resolution=4000, calibration="brightness_temperature")
area_def = fh.get_area_def(ds_id)
lons, lats = area_def.get_lonlats(chunks=1000)
assert "+lon_0=" + str(subsatellite_longitude) in area_def.crs.to_proj4()


def test_filehandler_has_start_and_end_time(insat_filehandler):
Expand Down

0 comments on commit 28aba2f

Please sign in to comment.