From 87af90f04705fa55cfa352d5481f65139474e43a Mon Sep 17 00:00:00 2001 From: "Kasper D. Fischer" Date: Sun, 3 Dec 2017 11:23:41 +0000 Subject: [PATCH] Updated WSGI scripts. --- .gitattributes | 1 + wsgi/plotFDSN.py | 20 +++++++++++++------- wsgi/showEnv.py | 17 +++++++++++++++++ 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 wsgi/showEnv.py diff --git a/.gitattributes b/.gitattributes index 1c8be81..8bc052e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,6 @@ * text=auto !eol scripts/mkEvents.csh -text +wsgi/showEnv.py -text www/.htaccess -text www/copyright.inc.de -text www/external/TileLayer.Grayscale.js -text diff --git a/wsgi/plotFDSN.py b/wsgi/plotFDSN.py index 1145823..09ba15a 100755 --- a/wsgi/plotFDSN.py +++ b/wsgi/plotFDSN.py @@ -133,7 +133,7 @@ def fancy_plot(st, wsgi=False, img_format='png', color=True): def trace_dayplot(st, deltat = None, - ftype='bandpass', fmin=1.0, fmax=7.0, + ftype='none', fmin=1.0, fmax=7.0, col=('b', 'r', 'g'), interval=20, outpattern='', wsgi=False): """ @@ -260,18 +260,24 @@ def main(backend=None, args=None, wsgi=False): if args['stime']: otime = UTCDateTime(args['stime']) else: - otime = UTCDateTime() - 3600 - deltat + otime = UTCDateTime() - 3600. - deltat network = args['station'].split('.')[0] station = args['station'].split('.')[1] if args['type'] == 'dayplot': - channel = 'BHZ' + if network == 'Z3': + channel = 'HHZ' + else: + channel = 'BHZ' else: - if args['length'] < 3600: + if args['length'] < 3600.: channel = 'HH?' else: - channel = 'BH?' + if network == 'Z3': + channel = 'HH?' + else: + channel = 'BH?' else: - otime = UTCDateTime('2014-11-15T11:35:25Z') + otime = UTCDateTime() - 3600. deltat = 30 network = 'GR' station = 'BUG' @@ -398,4 +404,4 @@ if __name__ == "__main__": if os.getenv('DISPLAY'): main(args=cla) else: - main('Agg', cla) \ No newline at end of file + main('Agg', cla) diff --git a/wsgi/showEnv.py b/wsgi/showEnv.py new file mode 100644 index 0000000..fc28441 --- /dev/null +++ b/wsgi/showEnv.py @@ -0,0 +1,17 @@ +def application(environ, start_response): + """ + Function application - Wrapper to process wsgi request + :param environ: contains information on the wsgi environment + :type environ: dict + :param start_response: function to process response header by the wsgi server + :type start_response: function + :return: response to be sent to the client by the wsgi server + :rtype: list + """ + + from cgi import FieldStorage + + form = FieldStorage(fp=environ['wsgi.input'], environ=environ) + + start_response('200 OK', [('Content-Type', 'text/html')]) + return [form] \ No newline at end of file