Skip to content

Commit

Permalink
Merge pull request #2049 from strandgren/bugfix-fci_l2_nc-reader
Browse files Browse the repository at this point in the history
Bugfix fci_l2_nc reader
  • Loading branch information
mraspaud authored Mar 10, 2022
2 parents 00ab42e + dc5e03e commit 8efd0a5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
21 changes: 2 additions & 19 deletions satpy/etc/readers/fci_l2_nc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,39 +48,35 @@ datasets:
file_type: nc_fci_clm
file_key: cloud_state
long_name: cloud_mask_classification
fill_value: 0

quality_illumination_clm:
name: quality_illumination_clm
resolution: 2000
file_type: nc_fci_clm
file_key: quality_illumination
long_name: illumination_classification
fill_value: 0

quality_nwp_parameters_clm:
name: quality_nwp_parameters_clm
resolution: 2000
file_type: nc_fci_clm
file_key: quality_nwp_parameters
long_name: quality_index
fill_value: 0

quality_MTG_parameters_clm:
name: quality_MTG_parameters_clm
resolution: 2000
file_type: nc_fci_clm
file_key: quality_MTG_parameters
long_name: quality_index
fill_value: [-127, 0]
fill_value: -127

quality_overall_processing_clm:
name: quality_overall_processing_clm
resolution: 2000
file_type: nc_fci_clm
file_key: quality_overall_processing
long_name: quality_index
fill_value: 0

product_quality_clm:
name: product_quality_clm
Expand All @@ -107,47 +103,41 @@ datasets:
file_type: nc_fci_ct
file_key: cloud_phase
long_name: cloud_phase
fill_value: 0

cloud_type:
name: cloud_type
resolution: 2000
file_type: nc_fci_ct
file_key: cloud_type
long_name: cloud_type
fill_value: 0

quality_illumination_ct:
name: quality_illumination_ct
resolution: 2000
file_type: nc_fci_ct
file_key: quality_illumination
long_name: illumination_classification
fill_value: 0

quality_nwp_parameters_ct:
name: quality_nwp_parameters_ct
resolution: 2000
file_type: nc_fci_ct
file_key: quality_nwp_parameters
long_name: quality_index
fill_value: 0

quality_MTG_parameters_ct:
name: quality_MTG_parameters_ct
resolution: 2000
file_type: nc_fci_ct
file_key: quality_MTG_parameters
long_name: quality_index
fill_value: 0

quality_overall_processing_ct:
name: quality_overall_processing_ct
resolution: 2000
file_type: nc_fci_ct
file_key: quality_overall_processing
long_name: quality_index
fill_value: 0

product_quality_ct:
name: product_quality_ct
Expand All @@ -173,7 +163,6 @@ datasets:
resolution: 2000
file_type: nc_fci_ctth
file_key: cloud_top_aviation_height
fill_value: 0

cloud_top_height:
name: cloud_top_height
Expand Down Expand Up @@ -207,7 +196,6 @@ datasets:
resolution: 2000
file_type: nc_fci_ctth
file_key: quality_status
fill_value: 0

quality_rtm_ctth:
name: quality_rtm_ctth
Expand All @@ -220,35 +208,31 @@ datasets:
resolution: 2000
file_type: nc_fci_ctth
file_key: quality_method
fill_value: 0

quality_nwp_parameters_ctth:
name: quality_nwp_parameters_ctth
resolution: 2000
file_type: nc_fci_ctth
file_key: quality_nwp_parameters
fill_value: 0

quality_MTG_parameters_ctth:
name: quality_MTG_parameters_ctth
resolution: 2000
file_type: nc_fci_ctth
file_key: quality_MTG_parameters
fill_value: [-127, 0]
fill_value: -127

quality_overall_processing_ctth:
name: quality_overall_processing_ctth
resolution: 2000
file_type: nc_fci_ctth
file_key: quality_overall_processing
fill_value: 0

quality_overall_processing_aviation_ctth:
name: quality_overall_processing_aviation_ctth
resolution: 2000
file_type: nc_fci_ctth
file_key: quality_overall_processing_aviation
fill_value: 0

product_quality_ctth:
name: product_quality_ctth
Expand All @@ -275,7 +259,6 @@ datasets:
file_type: nc_fci_oca
file_key: retrieved_cloud_phase
standard_name: thermodynamic_phase_of_cloud_water_particles_at_cloud_top
fill_value: 0

retrieved_cloud_optical_thickness:
name: retrieved_cloud_optical_thickness
Expand Down
5 changes: 4 additions & 1 deletion satpy/readers/fci_l2_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,12 @@ def _get_proj_area(self, dataset_id):
"""Extract projection and area information."""
# Read the projection data from the mtg_geos_projection variable
a = float(self._projection.attrs['semi_major_axis'])
rf = float(self._projection.attrs['inverse_flattering'])
h = float(self._projection.attrs['perspective_point_height'])

# Some L2PF test data files have a typo in the keyname for the inverse flattening parameter. Use a default value
# as fallback until all L2PF test files are correctly formatted.
rf = float(self._projection.attrs.get('inverse_flattening', 298.257223563))

res = dataset_id.resolution

area_naming_input_dict = {'platform_name': 'mtg',
Expand Down
4 changes: 2 additions & 2 deletions satpy/tests/reader_tests/test_fci_l2_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def setUp(self):
mtg_geos_projection = nc.createVariable('mtg_geos_projection', int, dimensions=())
mtg_geos_projection.longitude_of_projection_origin = 0.0
mtg_geos_projection.semi_major_axis = 6378137.
mtg_geos_projection.inverse_flattering = 298.257223563
mtg_geos_projection.inverse_flattening = 298.257223563
mtg_geos_projection.perspective_point_height = 35786400.

self.fh = FciL2NCFileHandler(filename=self.test_file, filename_info={}, filetype_info={})
Expand Down Expand Up @@ -461,7 +461,7 @@ def setUp(self):
mtg_geos_projection = nc_byte.createVariable('mtg_geos_projection', int, dimensions=())
mtg_geos_projection.longitude_of_projection_origin = 0.0
mtg_geos_projection.semi_major_axis = 6378137.
mtg_geos_projection.inverse_flattering = 298.257223563
mtg_geos_projection.inverse_flattening = 298.257223563
mtg_geos_projection.perspective_point_height = 35786400.

test_dataset = nc_byte.createVariable('cloud_mask_test_flag', np.float32,
Expand Down

0 comments on commit 8efd0a5

Please sign in to comment.