Skip to content
Snippets Groups Projects
Commit 705cc264 authored by Andi Gerken's avatar Andi Gerken
Browse files

Fixed calendar points to save time in microseconds according to track format

Removed forgotten debug code
parent 69e1c0de
No related branches found
No related tags found
1 merge request!9Fixed calendar points to save time in microseconds according to track format
Pipeline #37382 passed
......@@ -8,6 +8,7 @@ dist
.coverage
report.xml
htmlcov
html
docs
env
!tests/resources/*.hdf5
......
......@@ -190,10 +190,10 @@ class File(h5py.File):
def format_calendar_time_point(p):
if isinstance(p, datetime.datetime):
assert p.tzinfo is not None, "Missing timezone for calendar point."
return p.isoformat(timespec="milliseconds")
return p.isoformat(timespec="microseconds")
elif isinstance(p, str):
assert p == datetime.datetime.fromisoformat(p).isoformat(
timespec="milliseconds"
timespec="microseconds"
)
return p
else:
......@@ -205,8 +205,6 @@ class File(h5py.File):
format_calendar_time_point(p) for p in calendar_time_points
]
for c in calendar_time_points:
print(type(c))
sampling.create_dataset(
"calendar_time_points",
data=calendar_time_points,
......
......@@ -16,7 +16,7 @@ def now_iso8061() -> str:
str: The current time as iso8061 string.
"""
return datetime.datetime.now(datetime.timezone.utc).isoformat(
timespec="milliseconds"
timespec="microseconds"
)
......
......@@ -112,7 +112,7 @@ def test_multiple_entities():
# create new sampling
m_points = np.ones((timesteps))
c_points = np.empty((timesteps), dtype="O")
c_points[:5] = "2020-12-02T10:21:58.100+00:00"
c_points[:5] = "2020-12-02T10:21:58.100000+00:00"
c_points[5:] = robofish.io.now_iso8061()
new_sampling = sf.create_sampling(
......
......@@ -6,10 +6,10 @@ import numpy as np
def test_now_iso8061():
# Example time: 2021-01-05T14:33:40.401+00:00
# Example time: 2021-01-05T14:33:40.401000+00:00
time = robofish.io.now_iso8061()
assert type(time) == str
assert len(time) == 29
assert len(time) == 32
def test_read_multiple_single():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment