Changeset 2320 for TI02-CSML/trunk/csml


Ignore:
Timestamp:
23/03/07 15:18:47 (13 years ago)
Author:
domlowe
Message:

crs code working fully

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

Legend:

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

    r2288 r2320  
    223223    cat=csml.csmllibs.csmlcrs.CRSCatalogue() 
    224224    if type(feature) == csml.parser.GridSeriesFeature: 
    225         crs=cat.getCRS(feature.value.gridSeriesDomain.srsName) 
     225        crs=cat.getCRS(feature.value.gridSeriesDomain.srsName,feature.value.gridSeriesDomain.axisLabels) 
    226226        gridordinates = feature.value.gridSeriesDomain.coordTransformTable.gridOrdinates 
    227227    elif type(feature) == csml.parser.ProfileSeriesFeature: 
  • TI02-CSML/trunk/csml/API/ops_GridSeriesFeature.py

    r2305 r2320  
    5858    #get the CRS from a  the  catalogue 
    5959    cat=csml.csmllibs.csmlcrs.CRSCatalogue() 
    60     crs=cat.getCRS(self.value.gridSeriesDomain.srsName 
     60    crs=cat.getCRS(self.value.gridSeriesDomain.srsName, self.value.gridSeriesDomain.axisLabels 
    6161     
    6262    #non-feature specific setup code, mainly handles the time dimension/calendar 
  • TI02-CSML/trunk/csml/csmllibs/csmlcrs.py

    r2318 r2320  
    11import string 
    2 import cdms # just while testing 
     2import sys           
    33 
    44class CRSystem(object): 
     
    7474        crs.timeAxis=3 
    7575         
    76          
    7776        #define unknown 1D CRS: 
    7877        crs=CRSystem(srsName='ndg:crs:unknown', axes=['unknown']) 
     
    9291         
    9392             
    94     def getCRS(self, srsName): 
     93    def getCRS(self, srsName, labels=None): 
    9594        #given the name of a CRS e.g. 'ndg:crs:xypt' return the CRSystem object  
     95        #labels are only required if it is a ndg:pseudoCRS 
    9696        try: 
    9797            return self.systems[srsName] 
    9898        except: 
    99             if srsName='ndg:pseudoCRS': 
    100                 pass # need to implement the code to handle pseudo crs here 
     99            if srsName=='ndg:pseudoCRS': 
     100                labellist=[] 
     101                for label in labels.split(): 
     102                    labellist.append(label) 
     103            #need to find the right pseudosystem. 
     104            #at the moment a simple test on number of dimensions works, but need to make this more generic. 
     105            for psystem in self.pseudosystems: 
     106                if len(self.pseudosystems[psystem].axes) == len (labellist): 
     107                    return self.pseudosystems[psystem] 
    101108            else: 
    102109                return self.systems['ndg:crs:unknown'] 
     
    126133        Assumes the units are ordered to correspond with the axes 
    127134        Alternatively, supply with a list of knownCRSAxes names (e.g. 'latitude', 'longitude', 'height') to get the right crs object         
    128         ''' 
    129         import sys                
     135        '''      
    130136        axisorder=[] 
    131137 
     
    213219         
    214220def main(): 
    215     import sys 
     221    import cdms # just for testing 
    216222    #sys.stdout = open("/home/dom/svn/trunk/csml/testfiles/gridseries/crsout.txt", "w") 
    217223    cat=CRSCatalogue() 
Note: See TracChangeset for help on using the changeset viewer.