Changeset 2405


Ignore:
Timestamp:
16/04/07 11:15:16 (12 years ago)
Author:
domlowe
Message:

using 2d crs in profile series

Location:
TI02-CSML/trunk/csml
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/csml/API/ops_GridSeriesFeature.py

    r2396 r2405  
    154154    #perform the subset (note this included nearest neighbour searching, so may return a different set of kwargs 
    155155    pathToSubsetNetCDF, crs,frame, timeName, times, strTimes, caltype, axisorder,units, fulldata, fillvalue, kwargs=self._subsetGrid(csmlpath, ncpath,**kwargs)  
    156      
     156    latName=crs.axes[crs.latAxis] 
     157    lonName=crs.axes[crs.lonAxis] 
    157158    #Okay, got the data now. Need to write CSML feature and NetCDF files. 
    158159    #Writing out the CSML feature 
     
    166167    newGridOrds=[] 
    167168    for gridOrd in cTT.gridOrdinates: 
    168         if gridOrd.coordAxisLabel.CONTENT not in  ['latitude', 'longitude']: 
     169        if gridOrd.coordAxisLabel.CONTENT not in  [latName,lonName]: 
    169170            newGridOrds.append(gridOrd) 
    170171    cTT.gridOrdinates=newGridOrds 
    171     
    172      
    173     #determine the NEW crs (should be 2d e.g. height/time)TODO 
    174     #axes=[] 
    175     #units=[] 
    176     #for ord in newGridOrds: 
    177         #axes.append(ord.coordAxisLabel) 
    178         #units.append(ord. 
    179      
    180     #sys.exit() 
     172    axes=[] 
     173    for ord in newGridOrds: 
     174        axes.append(ord.coordAxisLabel.CONTENT) 
     175    cat = csml.csmllibs.csmlcrs.CRSCatalogue() 
     176    crsInfo=cat.determineCRS(knownCRSAxes=axes)     
     177    crs=cat.getCRS(crsInfo[0].srsName) 
     178     
    181179    newdomain.coordTransformTable=cTT     
    182180    newdomain.id=csml.csmllibs.csmlextra.getRandomID() 
    183181    #TODO need to remove 'location' from this srs 
    184     newdomain.srsName=self.value.gridSeriesDomain.srsName   
    185     newdomain.axisLabels=self.value.gridSeriesDomain.axisLabels 
    186     newdomain.srsDimension=self.value.gridSeriesDomain.srsDimension 
     182    newdomain.srsName=crsInfo[0].srsName 
     183    axisLabels=csml.csmllibs.csmlextra.stringify(crsInfo[1].keys()) 
     184    newdomain.axisLabels=axisLabels 
     185    newdomain.srsDimension=2 
    187186    newdomain.dimension=2 
    188187    rangeSet=csml.parser.RangeSet() 
     
    201200     
    202201    #create 'location' attribute: 
    203     latName=crs.axes[crs.latAxis] 
    204     lonName=crs.axes[crs.lonAxis] 
    205202    if (latName, lonName) is not (None, None): 
    206203        locStr ='%s %s'%(kwargs[latName], kwargs[lonName]) 
     
    211208     
    212209    #create a stand alone gridseries feature containing this coverage 
    213     subsettedFeature=csmlWrap.createProfileSeriesFeature(value=cvg,parameter=param, location=loc, featureID=csml.csmllibs.csmlextra.getRandomID(),name=self.id,description=self.description) 
     210    subsettedFeature=csmlWrap.createProfileSeriesFeature(value=cvg,parameter=param, location=loc, featureID=csml.csmllibs.csmlextra.getRandomID(),name=self.name,description=self.description) 
    214211  
    215212     
  • TI02-CSML/trunk/csml/csmllibs/csmlcrs.py

    r2320 r2405  
    135135        '''      
    136136        axisorder=[] 
    137  
     137         
    138138        if knownCRSAxes is not None: 
    139139            axes=knownCRSAxes 
  • TI02-CSML/trunk/csml/csmllibs/csmlextra.py

    r2348 r2405  
    232232        return [item]         
    233233 
     234def stringify(inputlist): 
     235    '''stringify takes a list and returns a string containing the contents of the list separated by spaces''' 
     236    strreturn='' 
     237    for item in inputlist: 
     238        strreturn=strreturn + item +' ' 
     239    return strreturn[:-1] 
     240 
    234241def main(): 
    235242    #test to check randomness of getRandomID() 
Note: See TracChangeset for help on using the changeset viewer.