Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion satpy/readers/fci_l2_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
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):

Check warning on line 236 in satpy/readers/fci_l2_nc.py

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ New issue: Complex Method

FciL2NCFileHandler.get_dataset has a cyclomatic complexity of 9, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
variable = self._mask_data(variable, dataset_info["fill_value"])

variable = self._set_attributes(variable, dataset_info)
Expand Down
12 changes: 11 additions & 1 deletion satpy/tests/reader_tests/test_fci_l2_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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),
Expand Down
Loading