Skip to content

Commit

Permalink
fixup! Fix data coverage test
Browse files Browse the repository at this point in the history
  • Loading branch information
tukiains committed Sep 19, 2023
1 parent 1cb569a commit 6946c82
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cloudnetpy_qc/quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ def run(self):
return
if n_time == 0:
return

expected_resolution = self.RESOLUTIONS.get(
expected_res = self.RESOLUTIONS.get(
self.cloudnet_file_type, self.DEFAULT_RESOLUTION
)
now = datetime.datetime.now(tz=datetime.timezone.utc)
Expand All @@ -266,9 +265,9 @@ def run(self):
duration = now - midnight
else:
duration = datetime.timedelta(days=1)
n_bins = max(1, duration // expected_resolution)
bins = max(1, duration // expected_res)
hist, _bin_edges = np.histogram(
time, bins=n_bins, range=(0, duration / time_unit)
time, bins=bins, range=(0, duration / time_unit)
)
missing = np.count_nonzero(hist == 0) / len(hist) * 100
if missing > 20:
Expand All @@ -279,9 +278,9 @@ def run(self):
self._add_info(message)

actual_res = np.median(np.diff(time)) * time_unit
if actual_res > expected_resolution * 1.05:
if actual_res > expected_res * 1.05:
self._add_warning(
f"Expected a measurement with interval at least {expected_resolution},"
f"Expected a measurement with interval at least {expected_res},"
f" got {actual_res} instead"
)

Expand Down

0 comments on commit 6946c82

Please sign in to comment.