Changeset 2630 for TI05-delivery/ows_framework
- Timestamp:
- 21/06/07 15:05:06 (12 years ago)
- Location:
- TI05-delivery/ows_framework/trunk/ows_server
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/csml_wms.py
r2629 r2630 12 12 from ows_server.lib.decorators import * 13 13 from ows_server.lib import grid_util, render 14 from ows_server.lib.csml_util import get_csml_doc, extract ToVariable14 from ows_server.lib.csml_util import get_csml_doc, extract_cache 15 15 import ows_server.lib.validators as V 16 16 … … 141 141 # render.render_variable() 142 142 #!TODO: This could be done better. 143 x1 = max(-180., min(180., bbox[0]))144 x2 = max(-180., min(180., bbox[2]))145 y1 = max(-90., min(90., bbox[1]))146 y2 = max(-90., min(90., bbox[3]))143 #x1 = max(-180., min(180., bbox[0])) 144 #x2 = max(-180., min(180., bbox[2])) 145 #y1 = max(-90., min(90., bbox[1])) 146 #y2 = max(-90., min(90., bbox[3])) 147 147 148 148 # Define the extraction selector 149 sel = dict(latitude=(y1, y2), longitude=(x1, x2))149 #sel = dict(latitude=(y1, y2), longitude=(x1, x2)) 150 150 151 151 # Parse dimensions. 152 sel = {} 152 153 for dim in self._iterDimensions(feature): 153 154 # For the moment hard-code time in. We don't support any other dimension yet. … … 160 161 raise OWS_E.MissingParameterValue('%s dimension not specified' % dim, dim) 161 162 162 163 # Get the entire lat/lon slice from the extract_cache 164 var = extract_cache[feature, sel] 163 165 164 try: 165 # Extract via CSML.subsetToGridSeries() 166 var = extractToVariable(feature, sel) 166 # Do geographical subsetting in cdms 167 var = var(latitude=(bbox[1], bbox[3]), longitude=(bbox[0], bbox[2]), squeeze=1) 167 168 168 # Deduce min and max 169 varmin = MA.minimum(var, None) 170 varmax = MA.maximum(var, None) 169 # Deduce min and max 170 #!TODO: How do we get the min/max? 171 #varmin = MA.minimum(var, None) 172 #varmax = MA.maximum(var, None) 173 varmin=0; varmax=100 171 174 172 173 img = render.render_variable(var, bbox, width, height, 0, 100) # varmin, varmax175 # Render variable to a PIL image 176 img = render.render_variable(var, bbox, width, height, varmin, varmax) 174 177 175 # Serialise it to PNG 176 buf = StringIO() 177 img.save(buf, 'PNG') 178 except Exception, e: 179 import pdb; pdb.post_mortem(sys.exc_info()[2]) 180 if isinstance(e, OWS_E.OwsError): 181 raise e 182 else: 183 raise OWS_E.NoApplicableCode(e) 178 # Serialise it to PNG 179 buf = StringIO() 180 img.save(buf, 'PNG') 184 181 185 182 return Response(content=buf.getvalue(), mimetype='image/png') -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/lib/csml_util.py
r2613 r2630 14 14 import zipfile 15 15 import tempfile 16 17 from ows_server.lib import csml_cache 18 extract_cache = csml_cache.CSMLCache(request.environ['paste.config']['app_conf']['tmp_dir'], max_size=3) 19 16 20 17 21 def get_csml_doc(file): -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/tests/functional/test_csml_wms.py
r2596 r2630 6 6 wms_ns = 'http://www.opengis.net/wms' 7 7 8 # T his depends on the value randomly generated by csmlscan.9 # However make_data.py sets the random seed so this should work.10 test_feature_id = ' DVVhDIq2'8 # Test id is hard coded for now until I work out how to get it dynamically within 9 # the test harness. 10 test_feature_id = 'QGYylL9h' 11 11 12 12 class TestGetCapabilities(TestController): 13 13 def setUp(self): 14 14 url = url_for(controller='csml_wms', 15 file=' test',15 file='clim_10', 16 16 request='GetCapabilities', 17 17 service='WMS', … … 35 35 # With 4 sub-layers 36 36 layers = layers[0].findall('./{%(ns)s}Layer' % dict(ns=wms_ns)) 37 assert len(layers) == 437 assert len(layers) == 9 38 38 39 39 class TestGetMap(TestController): 40 40 def setUp(self): 41 url = url_for(controller='csml_wms', file=' test',41 url = url_for(controller='csml_wms', file='clim_10', 42 42 request='GetMap', 43 43 layers=test_feature_id, -
TI05-delivery/ows_framework/trunk/ows_server/test.ini
r2629 r2630 17 17 [app:main] 18 18 use = config:development.ini#main_app 19 csml_dir = %(here)s/ows_server/tests/data20 19 21 20 # Add additional test specific configuration options as necessary.
Note: See TracChangeset
for help on using the changeset viewer.