Skip to content

Commit

Permalink
Add test for floating-point values
Browse files Browse the repository at this point in the history
  • Loading branch information
siiptuo committed Sep 19, 2023
1 parent b284ce4 commit a85fe46
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cloudnetpy_qc/quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,21 @@ def run(self):
self._add_warning("Data might not be range corrected.")


@test(
"Floating-point values",
"Test for special floating-point values which may indicate problems with the processing.",
)
class TestFloatingPointValues(Test):
def run(self):
for name, variable in self.nc.variables.items():
if variable.dtype.kind != "f":
continue
if np.isnan(variable[:]).any():
self._add_warning(f"Variable '{name}' contains NaN value(s).")
if np.isinf(variable[:]).any():
self._add_warning(f"Variable '{name}' contains infinite value(s).")


# ---------------------#
# ------ Errors ------ #
# -------------------- #
Expand Down

0 comments on commit a85fe46

Please sign in to comment.