Changeset 2707 for TI05-delivery/ows_framework/branches
- Timestamp:
- 04/07/07 17:16:13 (12 years ago)
- Location:
- TI05-delivery/ows_framework/branches/ows_framework-ddp/ows_server
- Files:
-
- 1 added
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
TI05-delivery/ows_framework/branches/ows_framework-ddp/ows_server/development.ini
r2695 r2707 14 14 use = egg:Paste#http 15 15 host = 0.0.0.0 16 port = 8 08016 port = 8440 17 17 18 18 [pipeline:main] … … 27 27 session_key = ows_server 28 28 session_secret = somesecret 29 csml_dir = /research/home/spascoe/host/saturn/data/ddc_data/obs29 #csml_dir = /research/home/spascoe/host/saturn/data/ddc_data/obs 30 30 tmp_dir = %(here)s/data/tmp 31 31 #used for wcs "store": 32 publish_dir=%(here)s/ows_server/private/filestore32 #publish_dir=%(here)s/ows_server/private/filestore 33 33 ows_common_config = %(here)s/eg_ows_capabilities.xml 34 34 ddp_image_dir = %(here)s/../../data/afixaa.pei3aug 35 35 36 36 # If you'd like to fine-tune the individual locations of the cache data dirs -
TI05-delivery/ows_framework/branches/ows_framework-ddp/ows_server/ows_server/config/routing.py
r2681 r2707 20 20 #map.connect(':controller/:action/:id') 21 21 #map.connect('*url', controller='template', action='view') 22 23 ######################################################################################### 24 ## NDG Configuration. Not being used in this application 25 ######################################################################################### 26 ## # These should conform to http://proj.badc.rl.ac.uk/ndg/wiki/PasteStack 27 ## # ... but don't ... yet ... 28 29 ## # the NDG OGC services 30 ## # change these when security layer is present and not before 31 ## #to 32 ## #map.connect('wms/:uri',controller='csml_wms') 33 ## #map.connect('wcs/:uri',controller='csml_wcs') 22 34 23 # These should conform to http://proj.badc.rl.ac.uk/ndg/wiki/PasteStack 24 # ... but don't ... yet ... 35 ## 36 ## map.connect(':file/wms', controller='csml_wms') 37 ## map.connect('wcs/:fileoruri', controller='csml_wcs') 38 ## map.connect(':fileoruri/wcs', controller='csml_wcs') 39 ## map.connect(':file/status/:jobID', controller='status', action='getStatus') 40 41 ## # following is the shell for the rest of the ndg 42 ## map.connect('login', controller='login') 43 ## map.connect('wayf', controller='login', action='wayf') 44 ## map.connect('logout', controller='logout') 45 ## map.connect('view/:uri', controller = 'retrieve', action='view') 46 ## map.connect('askCorrect/:uri', controller='retrieve', action='askCorrect') 47 ## map.connect('correct/:uri', controller='retrieve', action='correct') 48 ## map.connect('retrieve/:uri', controller = 'retrieve') 25 49 26 # the NDG OGC services 27 # change these when security layer is present and not before 28 #to 29 #map.connect('wms/:uri',controller='csml_wms') 30 #map.connect('wcs/:uri',controller='csml_wcs') 31 32 map.connect(':file/wms', controller='csml_wms') 33 map.connect('wcs/:fileoruri', controller='csml_wcs') 34 map.connect(':fileoruri/wcs', controller='csml_wcs') 35 map.connect(':file/status/:jobID', controller='status', action='getStatus') 36 37 # following is the shell for the rest of the ndg 38 map.connect('login', controller='login') 39 map.connect('wayf', controller='login', action='wayf') 40 map.connect('logout', controller='logout') 41 map.connect('view/:uri', controller = 'retrieve', action='view') 42 map.connect('askCorrect/:uri', controller='retrieve', action='askCorrect') 43 map.connect('correct/:uri', controller='retrieve', action='correct') 44 map.connect('retrieve/:uri', controller = 'retrieve') 50 ## # This route doesn't match the controller's parameters. 51 ## #map.connect('csml/:uri', controller='csml_api') 52 ## # Below is the way it worked before with added 53 ## # "csml" path component 54 ## map.connect('csml/:file.:format', controller='csml_api', action='index', 55 ## format='html') 56 ## map.connect('csml/:file/:(feature).:format', action='getFeature', 57 ## controller='csml_api', format='html') 58 ## map.connect('csml/:file/:feature/:action', controller='csml_api') 45 59 46 # This route doesn't match the controller's parameters. 47 #map.connect('csml/:uri', controller='csml_api') 48 # Below is the way it worked before with added 49 # "csml" path component 50 map.connect('csml/:file.:format', controller='csml_api', action='index', 51 format='html') 52 map.connect('csml/:file/:(feature).:format', action='getFeature', 53 controller='csml_api', format='html') 54 map.connect('csml/:file/:feature/:action', controller='csml_api') 60 ## map.connect('trackback/:uri', controller='trackback') 61 ## map.connect('discovery',controller='discovery') 62 ## map.connect('updatetab/:value',controller='tabs',action='update') 63 ## map.connect('addSelection/:uri/:name',controller='tabs',action='addSelection') 64 ## map.connect('clear/:value',controller='tabs',action='clear') 55 65 56 map.connect('trackback/:uri', controller='trackback') 57 map.connect('discovery',controller='discovery') 58 map.connect('updatetab/:value',controller='tabs',action='update') 59 map.connect('addSelection/:uri/:name',controller='tabs',action='addSelection') 60 map.connect('clear/:value',controller='tabs',action='clear') 66 # Channel all WMS requests to one controller 67 map.connect('wms', controller='ddp_wms') 61 68 62 69 return map -
TI05-delivery/ows_framework/branches/ows_framework-ddp/ows_server/ows_server/controllers/ddp_wms.py
r2693 r2707 12 12 from ows_server.lib.decorators import * 13 13 from ows_server.lib import grid_util, render 14 from ows_server.lib.csml_cache import csmlCache, extractCache15 14 import ows_server.lib.validators as V 16 17 from elementtree import ElementTree as ET18 15 19 16 from ows_common import exceptions as OWS_E … … 22 19 from ows_common.domain import ValuesUnit, PossibleValues 23 20 24 import cdms 21 from ows_server.models import ddp_data 22 23 #import cdms 25 24 import os, sys 26 25 from cStringIO import StringIO 27 import MA26 #import MA 28 27 29 class CsmlWmsController(OwsController):28 class DdpWmsController(OwsController): 30 29 31 30 _ows_parameters = { … … 40 39 # } 41 40 42 43 def _iterDimensions(self, feature):44 """45 Retrieve the non-geospatial dimensions of a feature.46 47 @return: generator of dimension names48 49 """50 # Waiting for this feature to be implemented51 #lat = feature.getLatitude()52 #lon = feature.getLongitude()53 lat = 'latitude'; lon = 'longitude'54 55 for axis_name in feature.getDomain():56 if axis_name not in [lat, lon]:57 yield axis_name58 59 def _loadFeatureDimensions(self, feature):60 dims = {}61 domain = feature.getDomain()62 for axis_name in self._iterDimensions(feature):63 axis = domain[axis_name]64 dims[axis_name] = Dimension(possibleValues=PossibleValues.fromAllowedValues(axis),65 #!TODO: see ticket:770 for how to populate this66 valuesUnit=ValuesUnit(uoms=[''],67 referenceSystems=['']))68 return dims69 70 def _loadFeatureSummary(self, feature):71 dims = self._loadFeatureDimensions(feature)72 73 return WmsDatasetSummary(identifier=feature.id,74 titles=[feature.description.CONTENT],75 boundingBoxes=[BoundingBox([-180,-90], [180,90],76 crs='CRS:84')],77 dimensions=dims,78 )79 80 41 def _loadCapabilities(self): 81 42 """ … … 84 45 """ 85 46 # Get default capabilities from superclass 86 sm = super( CsmlWmsController, self)._loadCapabilities()47 sm = super(DdpWmsController, self)._loadCapabilities() 87 48 88 49 # For WMS 1.3.0 compatibility we need a single root DatasetSummary 89 ds = WmsDatasetSummary(titles=['Root Dataset'], datasetSummaries=[], 50 ds = WmsDatasetSummary(titles=['DDP Test dataset (afixaa.pei3aug.pp)'], 51 datasetSummaries=[], 90 52 CRSs=['CRS:84']) 91 53 # Add a DatasetSummary for each feature 92 for f_n in c.dataset.getFeatureList():93 feature_ds = self._loadFeatureSummary(c.dataset.getFeature(f_n))94 ds.datasetSummaries.append(feature_ds)54 #for f_n in c.dataset.getFeatureList(): 55 # feature_ds = self._loadFeatureSummary(c.dataset.getFeature(f_n)) 56 # ds.datasetSummaries.append(feature_ds) 95 57 96 58 sm.contents = Contents(datasetSummaries=[ds]) … … 127 89 @parameter('Exceptions') 128 90 # Dimension parameters Time, Elevation, etc. are handled separately 129 def GetMap(self, file,version, layers, styles, crs, bbox, width, height, format,91 def GetMap(self, version, layers, styles, crs, bbox, width, height, format, 130 92 transparent=False, bgcolor=None, exceptions=None): 131 93 132 # Retrieve dataset and selected feature133 dataset = csmlCache[file]134 feature = dataset.getFeature(layers)135 if feature is None:136 raise OWS_E.InvalidParameterValue('Layer not found', 'layers') 94 variable = layers 95 96 # Check the layer refers to an available variable 97 if variable not in ddp_data.variables: 98 raise OWS_E.InvalidParameterValue('Layer not found', 'layers') 137 99 138 # Clean up bbox. Openlayers can request some very strange bboxes. It is trimmed 139 # here and the implications for the image's aspect ratio is calculated in 140 # render.render_variable() 141 #!TODO: This could be done better. 142 #x1 = max(-180., min(180., bbox[0])) 143 #x2 = max(-180., min(180., bbox[2])) 144 #y1 = max(-90., min(90., bbox[1])) 145 #y2 = max(-90., min(90., bbox[3])) 100 # Parse time dimension. 101 try: 102 time = self.ows_params['time'] 103 except KeyError: 104 raise OWS_E.MissingParameterValue('time dimension not specified', 'time') 146 105 147 # Define the extraction selector 148 #sel = dict(latitude=(y1, y2), longitude=(x1, x2)) 149 150 # Parse dimensions. 151 sel = {} 152 for dim in self._iterDimensions(feature): 153 # For the moment hard-code time in. We don't support any other dimension yet. 154 if dim.lower() != 'time': 155 raise ValueError('Only lat, lon and time are supported domain axes') 106 if time not in ddp_data.time_domain: 107 raise OWS_E.InvaludParameterValue('time dimension value incorrect', 'time') 156 108 157 try: 158 sel[dim] = self.ows_params[dim] 159 except KeyError: 160 raise OWS_E.MissingParameterValue('%s dimension not specified' % dim, dim) 161 162 # Get the entire lat/lon slice from the extractCache 163 var = extractCache[feature, sel] 164 165 # Do geographical subsetting in cdms 166 var = var(latitude=(bbox[1], bbox[3]), longitude=(bbox[0], bbox[2]), squeeze=1) 167 168 # Deduce min and max 169 #!TODO: How do we get the min/max? 170 #varmin = MA.minimum(var, None) 171 #varmax = MA.maximum(var, None) 172 varmin=0; varmax=100 173 174 # Render variable to a PIL image 175 img = render.render_variable(var, bbox, width, height, varmin, varmax) 109 # Get the PIL image for this variable/time 110 img = ddp_data.get_image_subset(variable, time, bbox, width, height) 176 111 177 112 # Serialise it to PNG
Note: See TracChangeset
for help on using the changeset viewer.