Changeset 4774


Ignore:
Timestamp:
09/01/09 10:11:07 (11 years ago)
Author:
domlowe
Message:

WCS axis descriptions for vertical axes now derived from CSML and correctly presented in DescribeCoverage?

Location:
cows/trunk/cows
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cows/trunk/cows/model/wcs.py

    r4769 r4774  
    1515from cows.model.domain import Domain 
    1616 
     17import logging 
     18log = logging.getLogger(__name__) 
     19 
    1720class WcsDatasetSummary(DatasetSummary): 
    1821    """ 
    1922    """ 
    20     def __init__(self, CRSs=[], description=None, formats=[],supportedCRSs=[],timepositions=[],timelimits=[],**kw): 
     23    def __init__(self, CRSs=[], description=None, formats=[],supportedCRSs=[],timepositions=[],timelimits=[],axisdescriptions=[], **kw): 
    2124        super(WcsDatasetSummary, self).__init__(**kw) 
    2225        self.CRSs = CRSs 
     
    2629        self.timePositions=timepositions 
    2730        self.timeLimits=timelimits 
     31        self.axisDescriptions=axisdescriptions 
     32 
    2833 
    2934class CoverageDescription(WcsDatasetSummary):  
     
    3136    Further extends WCSDatasetSummary to provide a fuller coverage description 
    3237    used in DescribeCoverageResponse. Building up this extra information may require more  
    33     work on the servers part, hence this is separate class from the simpler WcsDatasetSummary. 
     38    work on the servers part, hence this is currently a separate class from the simpler WcsDatasetSummary. 
     39    TODO: perhaps this isn't necessary.. 
    3440    """ 
    3541    def __init__(self, **kw): 
  • cows/trunk/cows/pylons/templates/wcs_describecoverage_1_0_0.xml

    r4769 r4774  
    11<?xml version="1.0"?> 
    2 <!DOCTYPE WMT_MS_Capabilities SYSTEM 
    3  "http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd"> 
    4  
    52<?python 
    63 
     
    1613        <name py:content="cd.identifier"/>         
    1714        <label py:if="cd.titles is not None" py:content="cd.titles"/>         
    18         <Keywords py:if = "cd.keywords is not None" > 
    19             <Keyword py:for="key in cd.keywords" py:content="key" />         
    20         </Keywords> 
    2115        <lonLatEnvelope py:for="bb in cd.boundingBoxes"> 
    2216                    <gml:pos>${bb.lowerCorner[0]}  ${bb.lowerCorner[1]}</gml:pos> 
    2317                    <gml:pos>${bb.upperCorner[0]}  ${bb.upperCorner[1]}</gml:pos> 
    2418        </lonLatEnvelope> 
     19                <keywords py:if = "len(cd.keywords)>0" > 
     20            <keyword py:for="key in cd.keywords" py:content="key" />         
     21        </keywords> 
    2522        <domainSet> 
    2623            <spatialDomain> 
     
    4239            <RangeSet> 
    4340                <name>rangeset name</name> 
    44                 <label>rangeset label</label>                 
     41                <label>rangeset label</label>     
     42                                <axisDescription py:for="axis in cd.axisDescriptions"> 
     43                                        <AxisDescription> 
     44                                                <name py:content="axis.name"/> 
     45                                                <label py:content="axis.label"/> 
     46                                                <values> 
     47                                                        <singleValue  py:for="value in axis.values" py:content="value"/> 
     48                                                </values> 
     49                                        </AxisDescription> 
     50                                </axisDescription>             
    4551            </RangeSet> 
    4652        </rangeSet> 
  • cows/trunk/cows/pylons/wcs_controller.py

    r4772 r4774  
    217217                                     supportedCRSs=coverage.crss,  
    218218                                     timepositions=coverage.timePositions, 
    219                                      timelimits=coverage.timeLimits 
    220                                      ) 
     219                                     timelimits=coverage.timeLimits,  
     220                                     axisdescriptions=coverage.axisDescriptions) 
    221221 
    222222                c.descriptions.append(ds) 
  • cows/trunk/cows/service/imps/csmlbackend/wcs_csmllayer.py

    r4772 r4774  
    4646            crss.append('CRS:84') 
    4747            crss.append('WGS84') 
    48  
    49         return title, abstract, timepositions, timelimits, units, crss 
     48         
     49        #build definitions of any Z axes such as air_pressure: 
     50        axisDescriptions=[]         
     51        lon=feature.getLongitudeAxis() 
     52        lat=feature.getLatitudeAxis() 
     53        t=feature.getTimeAxis() 
     54        if None in [lon, lat, t]: 
     55            #TODO need to return a suitable wcs error. 
     56            log.debug('warning, could not get correct axis info') 
     57            #best guess! 
     58            if t is None: 
     59                t='time' 
     60            if lon is None: 
     61                lon = 'longitude' 
     62            if lat is None: 
     63                lat = 'latitude' 
     64                 
     65         
     66        #get the valid values for the Z dimension e.g. the available pressure levels 
     67        for ax in feature.getAxisLabels(): 
     68            if ax not in [lat, lon, t]: 
     69                name=label=ax 
     70                domain=feature.getDomain() 
     71                values=domain[name].tolist() 
     72                axis=AxisDescription(name, label, values) 
     73                axisDescriptions.append(axis)    
     74 
     75        return title, abstract, timepositions, timelimits, units, crss, axisDescriptions 
    5076             
    5177    def getCoverageDescription(self): 
     
    7096        self._crscat=csml.csmllibs.csmlcrs.CRSCatalogue() 
    7197        for feature in csml.csmllibs.csmlextra.listify(ds.featureCollection.featureMembers): 
    72             title, abstract, timepositions, timelimits, units, crss=self.getInfo(feature) 
    73             layermap[feature.id]=CSMLCoverage([title],[abstract], timepositions, timelimits, units, crss, feature) 
     98            title, abstract, timepositions, timelimits, units, crss, axisDescriptions=self.getInfo(feature) 
     99            layermap[feature.id]=CSMLCoverage([title],[abstract], timepositions, timelimits, units, crss, axisDescriptions, feature) 
    74100        if len(layermap) > 0: 
    75101            self.layermapcache[fileoruri]=layermap 
     
    80106class AxisDescription(object): 
    81107    """ represents an axisDescription from the rangeSet (see wcs 1.0.0 describe coverage) """ 
    82     def __init__(self): 
    83         self.name='air_pressure' 
    84         self.label='air_pressure' 
    85         self.values=[10, 30, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 850, 950,1000] 
     108    def __init__(self, name, label, values): 
     109        self.name=name 
     110        self.label=label 
     111        self.values=values 
    86112 
    87113class CSMLCoverage(object): #TODO: define ICoverage 
    88114    """ represents a WCS Coverage. Implements ICoverage """ 
    89115     
    90     def __init__(self, title, abstract, timepositions, timelimits, units, crss, feature): 
     116    def __init__(self, title, abstract, timepositions, timelimits, units, crss, axisDescriptions, feature): 
    91117        self.title=title 
    92118        self.abstract=abstract 
     
    104130        self.wgs84BBox = bb 
    105131        self.featureInfoFormats = ['text/html'] 
    106         self.axisDescriptions = [AxisDescription()] 
     132        self.axisDescriptions = axisDescriptions 
    107133     
    108134    def getBBox(self, crs): 
Note: See TracChangeset for help on using the changeset viewer.