Skip to content
Snippets Groups Projects

Fix #11: local variable 'time_points' referenced before assignment

Merged Fix #11: local variable 'time_points' referenced before assignment
Merged mhocke requested to merge time-points into master
1 file
+ 8
9
Compare changes
  • Side-by-side
  • Inline
@@ -113,9 +113,7 @@ def validate(iofile: File, strict_validate: bool = True) -> (bool, str):
if a in sampling:
assert_validate_type(sampling[a], a_type, a, f"sampling {s_name}")
if "frequency_hz" in sampling.attrs:
pass
elif "monotonic_time_points_us" in sampling:
if "monotonic_time_points_us" in sampling:
time_points = sampling["monotonic_time_points_us"]
# 1 dimensional array
assert_validate(
@@ -138,12 +136,13 @@ def validate(iofile: File, strict_validate: bool = True) -> (bool, str):
"Dimensionality of calendar_time_points should be 1",
f"sampling {s_name}",
)
assert_validate(
calendar_points.shape[0] == time_points.shape[0],
"The length of calendar points (%d) does not match the length of monotonic points (%d)"
% (calendar_points.shape[0], time_points.shape[0]),
f"sampling {s_name}",
)
if "monotonic_time_points_us" in sampling:
assert_validate(
calendar_points.shape[0] == time_points.shape[0],
"The length of calendar points (%d) does not match the length of monotonic points (%d)"
% (calendar_points.shape[0], time_points.shape[0]),
f"sampling {s_name}",
)
# validate iso8601, this validates the dtype implicitly
for c in calendar_points.asstr(encoding="utf-8"):
Loading