Skip to content

Commit

Permalink
Merge pull request #2533 from yukaribbba/fix_fy4_geolocation_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese committed Aug 4, 2023
2 parents b0473aa + 6c7e5d0 commit 3a84a3b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
17 changes: 6 additions & 11 deletions satpy/readers/fy4_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,12 @@ def get_area_def(self, key):
# https://www.cgms-info.org/documents/cgms-lrit-hrit-global-specification-(v2-8-of-30-oct-2013).pdf
res = key['resolution']
pdict = {}
pdict['coff'] = self._COFF_list[RESOLUTION_LIST.index(res)]
pdict['loff'] = self._LOFF_list[RESOLUTION_LIST.index(res)]

begin_cols = float(self.file_content['/attr/Begin Pixel Number'])
end_lines = float(self.file_content['/attr/End Line Number'])
pdict['coff'] = self._COFF_list[RESOLUTION_LIST.index(res)] - begin_cols + 1
pdict['loff'] = -self._LOFF_list[RESOLUTION_LIST.index(res)] + end_lines + 1

pdict['cfac'] = self._CFAC_list[RESOLUTION_LIST.index(res)]
pdict['lfac'] = self._LFAC_list[RESOLUTION_LIST.index(res)]
try:
Expand All @@ -240,21 +244,12 @@ def get_area_def(self, key):
pdict['a_name'] = f'{self.filename_info["observation_type"]}_{res}m'
pdict['p_id'] = f'FY-4, {res}m'

pdict['nlines'] = pdict['nlines'] - 1
pdict['ncols'] = pdict['ncols'] - 1

pdict['coff'] = pdict['coff'] - 0.5
pdict['loff'] = pdict['loff'] + 1

area_extent = get_area_extent(pdict)
area_extent = (area_extent[0],
area_extent[1],
area_extent[2],
area_extent[3])

pdict['nlines'] = pdict['nlines'] + 1
pdict['ncols'] = pdict['ncols'] + 1

area = get_area_definition(pdict, area_extent)

return area
18 changes: 10 additions & 8 deletions satpy/tests/reader_tests/test_agri_l1.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@
RESOLUTION_LIST = [500, 1000, 2000, 4000]

AREA_EXTENTS_BY_RESOLUTION = {'FY4A': {
500: (-5495271.006002, -5496021.008869, -5493270.998357, -5495521.006957),
1000: (-5494521.070252, -5496021.076004, -5490521.054912, -5495021.072169),
2000: (-5493021.198696, -5496021.210274, -5485021.167823, -5494021.202556),
4000: (-5490021.187119, -5496021.210274, -5474021.125371, -5492021.194837)
500: (-5496021.008869, 5495021.005046, -5493520.999312, 5496021.008869),
1000: (-5496021.076004, 5494021.068334, -5491021.05683, 5496021.076004),
2000: (-5496021.210274, 5492021.194837, -5486021.171682, 5496021.210274),
4000: (-5496021.210274, 5488021.1794, -5476021.13309, 5496021.210274)
},
'FY4B': {
500: (-5495271.006002, -5496021.008869, -5493270.998357, -5495521.006957),
1000: (-5494521.070252, -5496021.076004, -5490521.054912, -5495021.072169),
2000: (-5493021.198696, -5496021.210274, -5485021.167823, -5494021.202556),
4000: (-5490021.187119, -5496021.210274, -5474021.125371, -5492021.194837)
500: (-5496021.008869, 5495021.005046, -5493520.999312, 5496021.008869),
1000: (-5496021.076004, 5494021.068334, -5491021.05683, 5496021.076004),
2000: (-5496021.210274, 5492021.194837, -5486021.171682, 5496021.210274),
4000: (-5496021.210274, 5488021.1794, -5476021.13309, 5496021.210274)
}}


Expand Down Expand Up @@ -201,6 +201,8 @@ def get_test_content(self, filename, filename_info, filetype_info):
'/attr/RegWidth': np.array(5.0),
'/attr/Begin Line Number': np.array(0),
'/attr/End Line Number': np.array(1),
'/attr/Begin Pixel Number': np.array(0),
'/attr/End Pixel Number': np.array(1),
'/attr/Observing Beginning Date': '2019-06-03', '/attr/Observing Beginning Time': '00:30:01.807',
'/attr/Observing Ending Date': '2019-06-03', '/attr/Observing Ending Time': '00:34:07.572',
'/attr/Satellite Name': 'FY4A', '/attr/Sensor Identification Code': 'AGRI', '/attr/Sensor Name': 'AGRI',
Expand Down

0 comments on commit 3a84a3b

Please sign in to comment.