Ignore:
Timestamp:
19/06/07 10:55:40 (12 years ago)
Author:
domlowe
Message:

WCS working with store parameter for asynchronous delivery

Location:
TI05-delivery/ows_framework/trunk/ows_server/ows_server
Files:
1 added
2 edited

Legend:

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

    r2601 r2607  
    2323 
    2424from ows_server.lib.csml_util import get_csml_doc, extractToNetCDF 
    25  
     25import os 
    2626 
    2727 
     
    104104    @parameter('TimeSequence',required=True)  #TODO, need validator to handle iso8601 time strings 
    105105    @parameter('Format', possibleValues=['image/netcdf'], required=True) 
    106      
     106    @parameter('Store', possibleValues=['true', 'True', 'TRUE']) 
    107107    #TODO some more parameter to add here 
    108108    # Dimension parameters Time, Elevation, etc. are handled separately 
    109     def GetCoverage(self, file, version, format, identifier, boundingbox, timesequence): 
     109    def GetCoverage(self, file, version, format, identifier, boundingbox, timesequence, store=None): 
    110110        try: 
    111111            # Retrieve dataset and selected feature 
     
    120120             
    121121            # Extract via CSML.subsetToGridSeries() 
    122             filename = extractToNetCDF(feature, sel) 
    123             netcdfFile=open(filename, 'r') 
     122            if store is not None:  
     123                filename = extractToNetCDF(feature, sel, publish=True) 
     124            else: 
     125                filename = extractToNetCDF(feature, sel) 
     126             
     127            #Depending on if the 'store' parameter is set, either return the netcdf file or a link to it. 
     128            if store is not None:  
     129                c.hyperlink = 'http://'+request.environ['HTTP_HOST']+'/'+os.path.basename(request.environ['paste.config']['app_conf']['publish_dir'])+'/'+filename 
     130                c.wcs_request=request.environ['HTTP_REFERER'] 
     131                return render_response('wcs_asynchronous') 
     132            else: 
     133                netcdfFile=open(filename, 'r') 
     134                return Response(content=netcdfFile, mimetype='image/netcdf')     
    124135        except Exception, e: 
    125136            if isinstance(e, OWS_E.OwsError): 
    126137                raise e 
    127138            else: 
    128                 raise OWS_E.NoApplicableCode(e) 
     139                raise e 
     140                #raise OWS_E.NoApplicableCode(e) 
    129141         
    130         return Response(content=netcdfFile, mimetype='image/netcdf') 
     142         
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/lib/csml_util.py

    r2606 r2607  
    5353     
    5454    # Subset the feature 
    55     (fd, filename) = tempfile.mkstemp('.nc', 'csml_wms_', extract_dir); os.close(fd) 
     55    (fd, filename) = tempfile.mkstemp('.nc', 'csml_wxs_', extract_dir); os.close(fd) 
    5656    feature.subsetToGridSeries(ncname=os.path.basename(filename), 
    5757                               outputdir=os.path.dirname(filename) ,**sel) 
Note: See TracChangeset for help on using the changeset viewer.