Coverage for /usr/local/lib/python3.11/dist-packages/pyrocko/squirrel/io/backends/tdms_idas.py: 50%
20 statements
« prev ^ index » next coverage.py v6.5.0, created at 2023-10-04 09:52 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2023-10-04 09:52 +0000
1# http://pyrocko.org - GPLv3
2#
3# The Pyrocko Developers, 21st Century
4# ---|P------/S----------~Lg----------
6'''
7Squirrel IO adaptor to :py:mod:`pyrocko.io.tdms_idas`.
8'''
10from pyrocko.io.io_common import get_stats, touch # noqa
11from ... import model
14def provided_formats():
15 return ['tdms_idas']
18def detect(first512):
19 from pyrocko.io import tdms_idas
21 if tdms_idas.detect(first512):
22 return 'tdms_idas'
23 else:
24 return None
27def iload(format, file_path, segment, content):
28 assert format == 'tdms_idas'
30 from pyrocko.io import tdms_idas
32 load_data = 'waveform' in content
34 for itr, tr in enumerate(tdms_idas.iload(file_path, load_data=load_data)):
36 nsamples = int(round((tr.tmax - tr.tmin) / tr.deltat)) + 1
38 nut = model.make_waveform_nut(
39 file_segment=0,
40 file_element=itr,
41 codes=tr.codes,
42 tmin=tr.tmin,
43 tmax=tr.tmin + tr.deltat * nsamples,
44 deltat=tr.deltat)
46 if 'waveform' in content:
47 nut.content = tr
49 yield nut