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

crs code working fully

File:
1 edited

Legend:

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