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

Merge branch 'develop' into 'master'

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

See merge request !9
parents f8ef18cd 95362f07
Branches
Tags 0.1.7
1 merge request!9Fixed calendar points to save time in microseconds according to track format
Pipeline #37385 passed
......@@ -234,10 +234,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:
......@@ -249,8 +249,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