feat: extract_mcap — MCAP NavSatFix + depth -> HDF5 /auv_mcap
This commit is contained in:
24
tests/test_extract_mcap.py
Normal file
24
tests/test_extract_mcap.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import tempfile, os
|
||||
import numpy as np
|
||||
import h5py
|
||||
import pytest
|
||||
|
||||
def test_write_auv_mcap_group():
|
||||
from extract.extract_mcap import write_auv_mcap_group
|
||||
t = np.array([1000, 2000, 3000], dtype=np.int64)
|
||||
lat = np.array([43.1, 43.2, 43.3])
|
||||
lon = np.array([5.6, 5.61, 5.62])
|
||||
depth = np.array([5.0, 5.5, 6.0])
|
||||
|
||||
with tempfile.NamedTemporaryFile(suffix=".h5", delete=False) as tmp:
|
||||
path = tmp.name
|
||||
try:
|
||||
write_auv_mcap_group(path, t, lat, lon, depth)
|
||||
with h5py.File(path, "r") as f:
|
||||
assert "auv_mcap" in f
|
||||
assert np.allclose(f["auv_mcap/lat"][:], lat)
|
||||
assert np.allclose(f["auv_mcap/lon"][:], lon)
|
||||
assert np.allclose(f["auv_mcap/depth_m"][:], depth)
|
||||
assert list(f["auv_mcap/t_ns"][:]) == list(t)
|
||||
finally:
|
||||
os.unlink(path)
|
||||
Reference in New Issue
Block a user