Skip to content
Snippets Groups Projects
Commit 731222c6 authored by mads's avatar mads
Browse files

Additional test

parent e0e8c0d3
No related branches found
No related tags found
No related merge requests found
Pipeline #
function [time, data, info] = gtsdf_load(filename)
% gtsdf_load Load a General time series data format - file
% Example:
% [time, data, info] = gtsdf_load('tests/test_files/test.hdf5')
%
if nargin==0
filename = 'examples/all.hdf5';
end
%h5disp('examples/minimum.hdf5');
%info = h5info(filename);
function value = att_value(name, addr, default)
try
value = h5readatt(filename, addr,name);
......@@ -32,7 +32,7 @@ function [time, data, info] = gtsdf_load(filename)
end
if not (strcmpi(att_value('type','/'), 'general time series data format'))
if not (strcmpi(lower(att_value('type','/')), 'general time series data format'))
error('HDF5 file must contain a ''type''-attribute with the value ''General time series data format''')
end
if strcmp(att_value('no_blocks','/'),'')
......
File added
......@@ -13,6 +13,7 @@ import os
import shutil
tmp_path = os.path.dirname(__file__) + "/tmp/"
tfp = os.path.dirname(__file__) + "/test_files/"
class Test_gsdf(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
......@@ -208,6 +209,13 @@ class Test_gsdf(unittest.TestCase):
attribute_descriptions=['d1', 'd2'])
df = gtsdf.load_pandas(fn)
def test_loadtesthdf5(self):
time, data, info = gtsdf.load(tfp + 'test.hdf5')
self.assertEqual(time[1], 0.05)
self.assertEqual(data[1, 1], 11.986652374267578)
self.assertEqual(info['attribute_names'][1], "WSP gl. coo.,Vy")
if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment