Changeset 2601


Ignore:
Timestamp:
18/06/07 15:16:02 (12 years ago)
Author:
domlowe
Message:

adding try except

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/csml_wcs.py

    r2600 r2601  
    108108    # Dimension parameters Time, Elevation, etc. are handled separately 
    109109    def GetCoverage(self, file, version, format, identifier, boundingbox, timesequence): 
     110        try: 
     111            # Retrieve dataset and selected feature 
     112            dataset = get_csml_doc(file) 
     113            feature = dataset.getFeature(identifier) 
     114            if feature is None: 
     115                raise OWS_E.InvalidParameterValue('Coverage not found', 'identifier') 
     116     
     117            #set bounding box TODO 
     118            sel = dict(latitude=(boundingbox[1], boundingbox[3]), longitude=(boundingbox[0], boundingbox[2])) 
     119            sel['time']=timesequence #needs validating 
     120             
     121            # Extract via CSML.subsetToGridSeries() 
     122            filename = extractToNetCDF(feature, sel) 
     123            netcdfFile=open(filename, 'r') 
     124        except Exception, e: 
     125            if isinstance(e, OWS_E.OwsError): 
     126                raise e 
     127            else: 
     128                raise OWS_E.NoApplicableCode(e) 
    110129         
    111         # Retrieve dataset and selected feature 
    112         dataset = get_csml_doc(file) 
    113         feature = dataset.getFeature(identifier) 
    114         if feature is None: 
    115             raise OWS_E.InvalidParameterValue('Coverage not found', 'identifier') 
    116  
    117         #set bounding box TODO 
    118         sel = dict(latitude=(boundingbox[1], boundingbox[3]), longitude=(boundingbox[0], boundingbox[2])) 
    119         sel['time']=timesequence #needs validating 
    120          
    121         # Extract via CSML.subsetToGridSeries() 
    122         filename = extractToNetCDF(feature, sel) 
    123         netcdfFile=open(filename, 'r') 
    124130        return Response(content=netcdfFile, mimetype='image/netcdf') 
Note: See TracChangeset for help on using the changeset viewer.