Skip to content

Commit b95eda7

Browse files
committed
More fixes for merge
1 parent a2d7eb7 commit b95eda7

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

clients/web/.DS_Store

-6 KB
Binary file not shown.

clients/web/htdocs/index.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ <h2> <a href="view-source:http://localhost:8000/wps?version=1.0.0&service=wps&re
88
<h2> <a href="view-source:http://localhost:8000/wps?version=1.0.0&service=wps&request=DescribeProcess&identifier=timeseries"> Describe Timeseries Process </a> </h2>
99
<pre><font size="5"><code> http://localhost/wps?version=1.0.0&service=wps&request=<b>DescribeProcess</b>&identifier=<i>timeseries</i></code></font></pre>
1010
<hr>
11-
<h2> <a href='view-source:http://localhost:8000/wps?version=1.0.0&service=wps&request=Execute&identifier=timeseries&datainputs=[domain={"longitude":120.0,"latitude":-40.0};variable={"url":"file://usr/local/cds/web/data/MERRA/Temp2D/MERRA_3Hr_Temp.nc","id":"t"}]'> Extract Timeseries From NetCDF File </a> </h2>
12-
<pre><font size="5"><code> http://localhost/wps?version=1.0.0&service=wps&request=<b>Execute</b>&identifier=<i>timeseries</i><p></p> &datainputs=[<p></p> domain={"longitude":65.3,"latitude":10.5,"level":100.0}; <p></p> variable={"url":"file://usr/local/cds/web/data/MERRA/Temp2D/MERRA_3Hr_Temp.nc","id":"t"}<p></p> ] </code></font></pre>
11+
<h2> <a href='view-source:http://localhost:8000/wps?version=1.0.0&service=wps&request=Execute&identifier=timeseries&datainputs=[domain={"longitude":120.0,"latitude":-40.0};variable={"url":"file://usr/local/web/WPCDAS/data/TestData.nc","id":"t"}]'> Extract Timeseries From NetCDF File </a> </h2>
12+
<pre><font size="5"><code> http://localhost/wps?version=1.0.0&service=wps&request=<b>Execute</b>&identifier=<i>timeseries</i><p></p> &datainputs=[<p></p> domain={"longitude":65.3,"latitude":10.5,"level":100.0}; <p></p> variable={"url":"file://usr/local/web/WPCDAS/data/TestData.nc","id":"t"}<p></p> ] </code></font></pre>
1313
<hr>
1414
<hr>
1515
<h2> <a href="view-source:http://localhost:8000/wps?version=1.0.0&service=wps&request=DescribeProcess&identifier=vcsplot"> Describe vcsPlot Process </a> </h2>
1616
<pre><font size="5"><code> http://localhost/wps?version=1.0.0&service=wps&request=<b>DescribeProcess</b>&identifier=<i>timeseries</i></code></font></pre>
1717
<hr>
18-
<h2> <a href='view-source:http://localhost:8000/wps?version=1.0.0&service=wps&request=Execute&identifier=vcsplot&datainputs=[plot={"gm":"boxfill"};embedded=true;domain={};variable={"url":"file://usr/local/cds/web/data/MERRA/Temp2D/MERRA_3Hr_Temp.nc","id":"t"}]'> Create vcs plot </a> </h2>
19-
<pre><font size="5"><code> http://localhost/wps?version=1.0.0&service=wps&request=<b>Execute</b>&identifier=<i>vcsplot</i><p></p> &datainputs=[<p></p> plot={"gm":"boxfill"}; <p></p> domain={}; <p></p> variable={"url":"file://usr/local/cds/web/data/MERRA/Temp2D/MERRA_3Hr_Temp.nc","id":"t"}<p></p> ] </code></font></pre>
18+
<h2> <a href='view-source:http://localhost:8000/wps?version=1.0.0&service=wps&request=Execute&identifier=vcsplot&datainputs=[plot={"gm":"boxfill"}domain={};variable={"url":"file://usr/local/web/WPCDAS/data/TestData.nc","id":"t"}]'> Create vcs plot </a> </h2>
19+
<pre><font size="5"><code> http://localhost/wps?version=1.0.0&service=wps&request=<b>Execute</b>&identifier=<i>vcsplot</i><p></p> &datainputs=[<p></p> plot={"gm":"boxfill"}; <p></p> domain={}; <p></p> variable={"url":"file://usr/local/web/WPCDAS/data/TestData.nc","id":"t"}<p></p> ] </code></font></pre>
2020
<hr>
2121
</body>
2222
</head>

server/analysis/timeseries_analysis.py

+20-7
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,27 @@ def applyOperation( self, input_variable, operation ):
9090
self.setTimeBounds( input_variable )
9191
operator = None
9292
# pydevd.settrace('localhost', port=8030, stdoutToServer=False, stderrToServer=True)
93+
wpsLog.debug( " $$$ ApplyOperation: %s " % str( operation ) )
9394
if operation is not None:
9495
type = operation.get('type','').lower()
9596
bounds = operation.get('bounds','').lower()
9697
op_start_time = time.clock() # time.time()
97-
wpsLog.debug( "applyOperation: %s " % str( [operation, type, bounds ] ) )
9898
if not bounds:
9999
if type == 'departures':
100100
ave = cdutil.averager( input_variable, axis='t', weights='equal' )
101101
result = input_variable - ave
102102
elif type == 'climatology':
103103
result = cdutil.averager( input_variable, axis='t', weights='equal' )
104+
else:
105+
result = input_variable
104106
time_axis = input_variable.getTime()
105107
elif bounds == 'np':
106108
if type == 'departures':
107109
result = ma.anomalies( input_variable ).squeeze()
108110
elif type == 'climatology':
109111
result = ma.average( input_variable ).squeeze()
112+
else:
113+
result = input_variable
110114
time_axis = input_variable.getTime()
111115
else:
112116
if bounds == 'djf': operator = cdutil.DJF
@@ -119,14 +123,21 @@ def applyOperation( self, input_variable, operation ):
119123
if operator <> None:
120124
if type == 'departures': result = operator.departures( input_variable ).squeeze()
121125
elif type == 'climatology': result = operator.climatology( input_variable ).squeeze()
126+
else: result = operator( input_variable ).squeeze()
122127
time_axis = result.getTime()
123128
op_end_time = time.clock() # time.time()
124129
wpsLog.debug( " ---> Base Operation Time: %.5f" % (op_end_time-op_start_time) )
130+
else:
131+
result = input_variable
132+
time_axis = input_variable.getTime()
125133

126134
if isinstance( result, float ):
127135
result_data = [ result ]
128-
else:
129-
result_data = result.tolist( numpy.nan ) if result is not None else None
136+
elif result is not None:
137+
if result.__class__.__name__ == 'TransientVariable':
138+
result = ma.masked_equal( result.squeeze().getValue(), input_variable.getMissing() )
139+
result_data = result.tolist( numpy.nan )
140+
else: result_data = None
130141
except Exception, err:
131142
wpsLog.debug( "Exception applying Operation '%s':\n %s" % ( str(operation), traceback.format_exc() ) )
132143
return ( None, None )
@@ -159,16 +170,18 @@ def setTimeBounds( self, var ):
159170
variables = [ { 'url': 'file://usr/local/web/data/MERRA/u750/merra_u750.xml', 'id': 'u' },
160171
{ 'url': 'file://usr/local/web/data/MERRA/MERRA100.xml', 'id': 't' },
161172
{ 'url': 'file://usr/local/web/data/MERRA/u750/merra_u750.nc', 'id': 'u' },
162-
{ 'url': 'file://usr/local/web/data/MERRA/u750/merra_u750_1979_1982.nc', 'id': 'u' } ]
163-
var_index = 2
173+
{ 'url': 'file://usr/local/web/data/MERRA/u750/merra_u750_1979_1982.nc', 'id': 'u' },
174+
{ 'url': 'file://usr/local/web/WPCDAS/data/TestData.nc', 'id': 't' } ]
175+
var_index = 4
164176
domain = { 'latitude': -18.2, 'longitude': -134.6 }
165177
operations = [ { 'type': 'departures', 'bounds': 'annualcycle' },
166178
{ 'type': 'departures', 'bounds': '' },
167179
{ 'type': 'climatology', 'bounds': 'annualcycle' },
168180
{ 'type': 'climatology', 'bounds': '' },
169181
{ 'type': 'departures', 'bounds': 'np' },
170-
{ 'type': 'climatology', 'bounds': 'np' } ]
171-
operation_index = 3
182+
{ 'type': 'climatology', 'bounds': 'np' },
183+
{ 'type': '', 'bounds': '' } ]
184+
operation_index = 6
172185

173186
processor = TimeseriesAnalytics( variables[var_index] )
174187
result = processor.execute( operations[operation_index], domain )

server/wps/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def wps(request):
111111
T=threading.Thread(target=run_wps,args=(request,out,err,rndm))
112112
T.start()
113113
if not requestParams['embedded'] and requestParams['execute']:
114-
return HttpResponse("Started Request Process id: <a href='%s/view/%i'>%i</a>" % (request.get_host(),rndm,rndm))
114+
return HttpResponse("Started Request Process id: <a href='http://%s/view/%i'>%i</a>" % (request.get_host(),rndm,rndm))
115115
else:
116116
T.join()
117117
out = open("out_%i.txt" % rndm)

0 commit comments

Comments
 (0)