diff --git a/satpy/readers/agri_l1.py b/satpy/readers/agri_l1.py index 232f72b380..cea1a560ed 100644 --- a/satpy/readers/agri_l1.py +++ b/satpy/readers/agri_l1.py @@ -105,9 +105,9 @@ def get_dataset(self, dataset_id, ds_info): data.attrs.update({'platform_name': satname, 'sensor': self['/attr/Sensor Identification Code'].lower(), 'orbital_parameters': { - 'satellite_nominal_latitude': self['/attr/NOMCenterLat'], - 'satellite_nominal_longitude': self['/attr/NOMCenterLon'], - 'satellite_nominal_altitude': self['/attr/NOMSatHeight']}}) + 'satellite_nominal_latitude': self['/attr/NOMCenterLat'].item(), + 'satellite_nominal_longitude': self['/attr/NOMCenterLon'].item(), + 'satellite_nominal_altitude': self['/attr/NOMSatHeight'].item()}}) data.attrs.update(ds_info) # remove attributes that could be confusing later diff --git a/satpy/tests/reader_tests/test_agri_l1.py b/satpy/tests/reader_tests/test_agri_l1.py index ccb3e788f8..60eae5fcdb 100644 --- a/satpy/tests/reader_tests/test_agri_l1.py +++ b/satpy/tests/reader_tests/test_agri_l1.py @@ -184,10 +184,16 @@ def _get_4km_data(self, file_type): def get_test_content(self, filename, filename_info, filetype_info): """Mimic reader input file content.""" global_attrs = { - '/attr/NOMCenterLat': 0.0, '/attr/NOMCenterLon': 104.7, '/attr/NOMSatHeight': 3.5786E7, - '/attr/dEA': 6378.14, '/attr/dObRecFlat': 298.257223563, - '/attr/OBIType': 'REGC', '/attr/RegLength': 2.0, '/attr/RegWidth': 5.0, - '/attr/Begin Line Number': 0, '/attr/End Line Number': 1, + '/attr/NOMCenterLat': np.array(0.0), + '/attr/NOMCenterLon': np.array(104.7), + '/attr/NOMSatHeight': np.array(3.5786E7), + '/attr/dEA': np.array(6378.14), + '/attr/dObRecFlat': np.array(298.257223563), + '/attr/OBIType': 'REGC', + '/attr/RegLength': np.array(2.0), + '/attr/RegWidth': np.array(5.0), + '/attr/Begin Line Number': np.array(0), + '/attr/End Line 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', @@ -286,6 +292,14 @@ def test_fy4a_all_resolutions(self): else: self.assertEqual('K', res[band_name].attrs['units']) + # check whether the data type of orbital_parameters is float + orbital_parameters = res[band_names[0]].attrs['orbital_parameters'] + for attr in orbital_parameters: + self.assertEqual(type(orbital_parameters[attr]), float) + self.assertEqual(orbital_parameters['satellite_nominal_latitude'], 0.) + self.assertEqual(orbital_parameters['satellite_nominal_longitude'], 104.7) + self.assertEqual(orbital_parameters['satellite_nominal_altitude'], 3.5786E7) + def test_fy4a_counts_calib(self): """Test loading data at counts calibration.""" from satpy import DatasetID