Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Javier Quinteros
dastools
Commits
5b6754dc
Commit
5b6754dc
authored
Jun 27, 2019
by
Javier Quinteros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write to MiniSEED using Obspy.
parent
6186ba20
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
dasscripts/dasconv.py
dasscripts/dasconv.py
+19
-4
No files found.
dasscripts/dasconv.py
View file @
5b6754dc
...
...
@@ -24,6 +24,9 @@ import datetime
import
numpy
as
np
from
math
import
floor
from
math
import
ceil
from
obspy
import
UTCDateTime
from
obspy
import
Trace
from
obspy
import
Stream
class
TDMS
(
object
):
...
...
@@ -294,9 +297,10 @@ class TDMS(object):
# Loop through channels
for
ch
in
range
(
self
.
__chstart
,
self
.
__chstop
+
1
,
self
.
__chstep
):
data
=
self
.
__readdata
(
channel
=
ch
)
stats
=
{
'network'
:
'XX'
,
'station'
:
'XXXX'
,
'location'
:
''
,
'channel'
:
str
(
ch
),
'npts'
:
len
(
data
),
'sampling_rate'
:
self
.
sampling_rate
}
stats
=
{
'network'
:
'XX'
,
'station'
:
'%05d'
%
ch
,
'location'
:
''
,
'channel'
:
'FH1'
,
'npts'
:
len
(
data
),
'sampling_rate'
:
self
.
sampling_rate
,
'starttime'
:
UTCDateTime
(
self
.
__twstart
)}
yield
(
data
,
stats
)
def
__iter_metadata__
(
self
):
...
...
@@ -454,10 +458,21 @@ def main():
starttime
=
dtstart
,
endtime
=
dtend
)
with
td
:
print
(
td
.
starttime
,
td
.
endtime
)
if
td
.
datatype
.
endswith
(
'i2'
):
enc
=
1
elif
td
.
datatype
.
endswith
(
'f4'
):
enc
=
4
else
:
raise
Exception
(
'Encoding type not supported to export in MiniSEED!'
)
for
data
,
stats
in
td
:
st
=
Stream
([
Trace
(
data
=
data
,
header
=
stats
)])
print
(
stats
)
print
(
data
)
print
(
st
)
st
.
write
(
'%s.%s.%s.%s.mseed'
%
(
stats
[
'network'
],
stats
[
'station'
],
stats
[
'location'
],
stats
[
'channel'
]),
format
=
'MSEED'
)
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment