Commit dea34302 authored by Javier Quinteros's avatar Javier Quinteros

Bugfix: Select all channels with '*' and minor improvements

Rename application.wadl to dataselect.wadl
parent 49287c0c
......@@ -586,34 +586,19 @@ class DataselectAPI(object):
raise cherrypy.HTTPError(400, errormessage(400, message))
# Network
if network not in ('*', self.__net):
cherrypy.response.headers['Content-Type'] = 'text/plain'
raise cherrypy.HTTPError(204, 'No Data')
# Net
if net not in ('*', self.__net):
cherrypy.response.headers['Content-Type'] = 'text/plain'
raise cherrypy.HTTPError(204, 'No Data')
if network not in ('*', self.__net) or net not in ('*', self.__net):
cherrypy.response.status = 204
return
# Location
if location not in ('*', self.__loc):
cherrypy.response.headers['Content-Type'] = 'text/plain'
raise cherrypy.HTTPError(204, 'No Data')
# Loc
if loc not in ('*', self.__loc):
cherrypy.response.headers['Content-Type'] = 'text/plain'
raise cherrypy.HTTPError(204, 'No Data')
if location not in ('*', self.__loc) or loc not in ('*', self.__loc):
cherrypy.response.status = 204
return
# Channel
if channel not in ('*', self.__cha):
cherrypy.response.headers['Content-Type'] = 'text/plain'
raise cherrypy.HTTPError(204, 'No Data')
# Cha
if cha not in ('*', self.__cha):
cherrypy.response.headers['Content-Type'] = 'text/plain'
raise cherrypy.HTTPError(204, 'No Data')
if channel not in ('*', self.__cha) or cha not in ('*', self.__cha):
cherrypy.response.status = 204
return
# Station and sta
# Discard the most comprehensive case of '*' and keep the most restricted one
......@@ -629,9 +614,7 @@ class DataselectAPI(object):
# Station(s)
try:
liststa = [int(x) for x in auxsta.split(',')]
if not len(liststa):
raise Exception
liststa = [] if auxsta == '*' else [int(x) for x in auxsta.split(',')]
except Exception:
# Send Error 400
message = 'Wrong formatted list of stations (%s).' % sta
......@@ -678,6 +661,20 @@ class DataselectAPI(object):
:returns: miniSEED data
:rtype: bytearray
"""
if not len(streams):
t = TDMS(self.__experiment, directory=self.__directory, starttime=starttime, endtime=endtime)
with t:
for data in t:
# Create the Trace
tr0 = Trace(data=data[0], header=data[1])
auxout = BytesIO()
tr0.write(auxout, format='MSEED', reclen=512)
yield auxout.getvalue()
auxout.close()
return
for stream in streams:
t = TDMS(self.__experiment, directory=self.__directory, starttime=starttime, endtime=endtime,
chstart=stream, chstop=stream)
......
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