Open vhfirat opened 6 days ago
Describe the bug ahi_hrit reader cannot create a Scene from Himawari AHI HRIT files with Python 3.11 and NumPy 2.
To Reproduce
filenames = glob.glob('/path_to_input/IMG*') scn = Scene(filenames=filenames, reader='ahi_hrit')
Expected behavior scn created with no issues.
Actual results [DEBUG: 2024-11-01 15:30:10 : satpy.readers.yaml_reader] Reading ('/env/lib/python3.11/site-packages/satpy/etc/readers/ahi_hrit.yaml',) [DEBUG: 2024-11-01 15:30:10 : satpy.readers.yaml_reader] Assigning to ahi_hrit: ['IMG_DK01B01_202410281420_001', 'IMG_DK01B01_202410281429_010', 'IMG_DK01B01_202410281420_002', 'IMG_DK01B01_202410281428_009', 'IMG_DK01B01_202410281422_004', 'IMG_DK01B01_202410281427_008', 'IMG_DK01B01_202410281425_006', 'IMG_DK01B01_202410281426_007', 'IMG_DK01B01_202410281424_005', 'IMG_DK01B01_202410281421_003', 'IMG_DK01B02_202410281424_005', 'IMG_DK01B02_202410281422_004', 'IMG_DK01B02_202410281425_006', 'IMG_DK01B02_202410281427_008', 'IMG_DK01B02_202410281420_002', 'IMG_DK01B02_202410281421_003', 'IMG_DK01B02_202410281428_009', 'IMG_DK01B02_202410281429_010', 'IMG_DK01B02_202410281420_001', 'IMG_DK01B02_202410281426_007', 'IMG_DK01VIS_202410281420_001', 'IMG_DK01VIS_202410281427_008', 'IMG_DK01VIS_202410281420_002', 'IMG_DK01VIS_202410281428_009', 'IMG_DK01VIS_202410281422_004', 'IMG_DK01VIS_202410281424_005', 'IMG_DK01VIS_202410281425_006', 'IMG_DK01VIS_202410281429_010', 'IMG_DK01VIS_202410281426_007', 'IMG_DK01VIS_202410281421003'] Traceback (most recent call last): File "\<stdin>", line 1, in \<module> File "/env/lib/python3.11/site-packages/satpy/scene.py", line 155, in __init_\ self._readers = self._create_reader_instances(filenames=filenames, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/scene.py", line 176, in _create_reader_instances return load_readers(filenames=filenames, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/init.py", line 572, in load_readers reader_instance.create_storage_items( File "/env/lib/python3.11/site-packages/satpy/readers/yaml_reader.py", line 617, in create_storage_items return self.create_filehandlers(files, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/yaml_reader.py", line 1180, in create_filehandlers created_fhs = super(GEOSegmentYAMLReader, self).create_filehandlers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/yaml_reader.py", line 629, in create_filehandlers filehandlers = self._new_filehandlers_for_filetype(filetype_info, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/yaml_reader.py", line 612, in _new_filehandlers_for_filetype return list(filtered_iter) ^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/yaml_reader.py", line 594, in filter_fh_by_metadata for filehandler in filehandlers: File "/env/lib/python3.11/site-packages/satpy/readers/yaml_reader.py", line 590, in _new_filehandler_instances yield filetype_cls(filename, filename_info, filetype_info, req_fh, *fh_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/hritjma.py", line 278, in __init_\ self.area = self._get_area_def() ^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/hrit_jma.py", line 365, in _get_area_def "loff": self._get_line_offset(), ^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/hrit_jma.py", line 349, in _get_line_offset loff -= (self.mda["total_no_image_segm"] - segment_number - 1) nlines
OverflowError: Python integer 550 out of bounds for uint8 **Environment Info:** satpy=0.51.0 python=3.11.10 numpy=2.1.2
There's an unreleased fix in https://github.com/pytroll/satpy/pull/2930
Describe the bug ahi_hrit reader cannot create a Scene from Himawari AHI HRIT files with Python 3.11 and NumPy 2.
To Reproduce
Expected behavior scn created with no issues.
Actual results [DEBUG: 2024-11-01 15:30:10 : satpy.readers.yaml_reader] Reading ('/env/lib/python3.11/site-packages/satpy/etc/readers/ahi_hrit.yaml',) [DEBUG: 2024-11-01 15:30:10 : satpy.readers.yaml_reader] Assigning to ahi_hrit: ['IMG_DK01B01_202410281420_001', 'IMG_DK01B01_202410281429_010', 'IMG_DK01B01_202410281420_002', 'IMG_DK01B01_202410281428_009', 'IMG_DK01B01_202410281422_004', 'IMG_DK01B01_202410281427_008', 'IMG_DK01B01_202410281425_006', 'IMG_DK01B01_202410281426_007', 'IMG_DK01B01_202410281424_005', 'IMG_DK01B01_202410281421_003', 'IMG_DK01B02_202410281424_005', 'IMG_DK01B02_202410281422_004', 'IMG_DK01B02_202410281425_006', 'IMG_DK01B02_202410281427_008', 'IMG_DK01B02_202410281420_002', 'IMG_DK01B02_202410281421_003', 'IMG_DK01B02_202410281428_009', 'IMG_DK01B02_202410281429_010', 'IMG_DK01B02_202410281420_001', 'IMG_DK01B02_202410281426_007', 'IMG_DK01VIS_202410281420_001', 'IMG_DK01VIS_202410281427_008', 'IMG_DK01VIS_202410281420_002', 'IMG_DK01VIS_202410281428_009', 'IMG_DK01VIS_202410281422_004', 'IMG_DK01VIS_202410281424_005', 'IMG_DK01VIS_202410281425_006', 'IMG_DK01VIS_202410281429_010', 'IMG_DK01VIS_202410281426_007', 'IMG_DK01VIS_202410281421003'] Traceback (most recent call last): File "\<stdin>", line 1, in \<module> File "/env/lib/python3.11/site-packages/satpy/scene.py", line 155, in __init_\ self._readers = self._create_reader_instances(filenames=filenames, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/scene.py", line 176, in _create_reader_instances return load_readers(filenames=filenames, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/init.py", line 572, in load_readers reader_instance.create_storage_items( File "/env/lib/python3.11/site-packages/satpy/readers/yaml_reader.py", line 617, in create_storage_items return self.create_filehandlers(files, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/yaml_reader.py", line 1180, in create_filehandlers created_fhs = super(GEOSegmentYAMLReader, self).create_filehandlers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/yaml_reader.py", line 629, in create_filehandlers filehandlers = self._new_filehandlers_for_filetype(filetype_info, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/yaml_reader.py", line 612, in _new_filehandlers_for_filetype return list(filtered_iter) ^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/yaml_reader.py", line 594, in filter_fh_by_metadata for filehandler in filehandlers: File "/env/lib/python3.11/site-packages/satpy/readers/yaml_reader.py", line 590, in _new_filehandler_instances yield filetype_cls(filename, filename_info, filetype_info, req_fh, *fh_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/hritjma.py", line 278, in __init_\ self.area = self._get_area_def() ^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/hrit_jma.py", line 365, in _get_area_def "loff": self._get_line_offset(), ^^^^^^^^^^^^^^^^^^^^^^^ File "/env/lib/python3.11/site-packages/satpy/readers/hrit_jma.py", line 349, in _get_line_offset loff -= (self.mda["total_no_image_segm"] - segment_number - 1) nlines