Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix (FY4A AGRI): Correct the type of orbital_parameters to float #1244

Merged
merged 7 commits into from Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions satpy/readers/agri_l1.py
Expand Up @@ -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': float(self['/attr/NOMCenterLat']),
'satellite_nominal_longitude': float(self['/attr/NOMCenterLon']),
'satellite_nominal_altitude': float(self['/attr/NOMSatHeight'])}})
data.attrs.update(ds_info)

# remove attributes that could be confusing later
Expand Down
19 changes: 15 additions & 4 deletions satpy/tests/reader_tests/test_agri_l1.py
Expand Up @@ -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',
Expand Down Expand Up @@ -286,6 +292,11 @@ 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)
sfinkens marked this conversation as resolved.
Show resolved Hide resolved

def test_fy4a_counts_calib(self):
"""Test loading data at counts calibration."""
from satpy import DatasetID
Expand Down