diff --git a/satpy/readers/fci_l2_nc.py b/satpy/readers/fci_l2_nc.py index 730d1ae7ae..d5b0e037ba 100644 --- a/satpy/readers/fci_l2_nc.py +++ b/satpy/readers/fci_l2_nc.py @@ -233,7 +233,7 @@ def get_dataset(self, dataset_id, dataset_info): if dataset_info["file_type"] == "nc_fci_test_clm": variable = self._decode_clm_test_data(variable, dataset_info) - if "fill_value" in dataset_info: + if "fill_value" in dataset_info and np.issubdtype(variable.dtype, np.inexact): variable = self._mask_data(variable, dataset_info["fill_value"]) variable = self._set_attributes(variable, dataset_info) diff --git a/satpy/tests/reader_tests/test_fci_l2_nc.py b/satpy/tests/reader_tests/test_fci_l2_nc.py index 2761e92c60..62c5f096be 100644 --- a/satpy/tests/reader_tests/test_fci_l2_nc.py +++ b/satpy/tests/reader_tests/test_fci_l2_nc.py @@ -222,7 +222,7 @@ def test_dataset_with_scalar(self): with pytest.raises(NotImplementedError): self.fh.get_area_def(None) - def test_emumerations(self): + def test_enumerations(self): """Test the conversion of enumerated type information into flag_values and flag_meanings.""" dataset = self.fh.get_dataset(make_dataid(name="test_enum", resolution=2000), {"name": "quality_flag", @@ -235,6 +235,16 @@ def test_emumerations(self): assert "flag_meanings" in attributes assert attributes["flag_meanings"] == ["False","True"] + def test_enum_with_fill_value_remains_int(self): + """Test that enum with a fill value (such as cloud type) remains uint8.""" + dataset = self.fh.get_dataset(make_dataid(name="test_enum", resolution=2000), + {"name": "quality_flag", + "nc_key": "quality_flag", + "file_type": "test_file_type", + "import_enum_information": True, + "fill_value": -127}) + assert np.issubdtype(dataset.dtype, np.integer) + def test_units_from_file(self): """Test units extraction from NetCDF file.""" dataset = self.fh.get_dataset(make_dataid(name="test_units_from_file", resolution=2000),