Commit 566095f9 authored by Javier Quinteros's avatar Javier Quinteros

First draft output for StationWS at channel level

One entry per file. Needs to be merged. Start and Endtime always as the ones in the first file.
This should be updated probably in tdms.py
parent f341311d
......@@ -434,20 +434,71 @@ return StationXML.
:returns: miniSEED data
:rtype: bytearray
"""
# TODO Misspelling which could possibly be fixed in the future
latkey = 'SystemInfomation.GPS.Latitude'
lonkey = 'SystemInfomation.GPS.Longitude'
elevkey = 'SystemInfomation.GPS.Altitude'
stkey = 'GPSTimeStamp'
srkey = 'SamplingFrequency[Hz]'
if not len(streams):
t = TDMS(self.__experiment, directory=self.__directory, starttime=starttime, endtime=endtime, iterate='M')
with t:
lat = None
lon = None
elev = None
samprate = None
stt = t.starttime
ent = t.endtime
for data in t:
yield json.dumps(data, default=datetime.isoformat)
if lat is None:
lat = data[latkey]
if lon is None:
lon = data[lonkey]
if elev is None:
elev = data[elevkey]
if samprate is None:
samprate = data[srkey]
# if not data['data']:
# yield json.dumps(data, default=datetime.isoformat)
if data['data']:
text = 'XX|%s||FH1|%s|%s|%s|depth|azimuth|dip|DAS|Scale|ScaleFrequency|ScaleUnits|%s|%s|%s\n' %\
(data['id'], lat, lon, elev, samprate, stt.isoformat(), ent.isoformat())
# yield json.dumps(data, default=datetime.isoformat)
yield text
return
for stream in streams:
t = TDMS(self.__experiment, directory=self.__directory, starttime=starttime, endtime=endtime,
chstart=stream, chstop=stream, iterate='M')
with t:
lat = None
lon = None
elev = None
samprate = None
stt = t.starttime
ent = t.endtime
for data in t:
yield json.dumps(data, default=datetime.isoformat)
if lat is None:
lat = data[latkey]
if lon is None:
lon = data[lonkey]
if elev is None:
elev = data[elevkey]
if samprate is None:
samprate = data[srkey]
# if not data['data']:
# yield json.dumps(data, default=datetime.isoformat)
if data['data']:
text = 'XX|%s||FH1|%s|%s|%s|depth|azimuth|dip|DAS|Scale|ScaleFrequency|ScaleUnits|%s|%s|%s\n' %\
(data['id'], lat, lon, elev, samprate, stt.isoformat(), ent.isoformat())
# yield json.dumps(data, default=datetime.isoformat)
yield text
@cherrypy.expose
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment