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?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.