Changeset 1673


Ignore:
Timestamp:
07/11/06 10:06:02 (13 years ago)
Author:
domlowe
Message:

subclassed cdunifdatainterface to create cdmldatainterface. This takes into account differences in the cdml and cdms apis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/csml/csmllibs/csmldataiface.py

    r1668 r1673  
    1111 
    1212 
    13 import sys 
    1413import cdms  
    1514try: 
    1615    import nappy  
    1716except ImportError: 
    18     sys.stdout.write('Could not import NASAAmes interface') 
     17    print 'could not import NASAAmes interface' 
    1918import string 
    2019import sys 
     
    4039                #this function to examine the file and return the correct interface (if it exists). 
    4140                fileExtension = str(filename)[-3:] 
     41                print 'fe: %s'%fileExtension 
    4242                if fileExtension == '.nc': 
    4343                        return cdunifInterface() 
     
    4949                        return cdunifInterface() 
    5050                elif fileExtension == 'xml': 
    51                         return cdunifInterface() 
     51                        return cdmlInterface() 
    5252                else: 
    5353                        try: 
     
    433433         
    434434     
    435  
    436          
     435class cdmlInterface(cdunifInterface): 
     436    #this is more  or less the cdunif interface but a few methods have been overwritten 
     437    def __init__(self): 
     438        #this all needs to be revisited in csml v2. 
     439        self.extractType='cdmlExtract' 
     440        self.extractPrefix = '_cdmlextract_' 
     441         
     442    def getListOfAxes(self): 
     443        axes=self.file.axes.keys()  
     444        return axes 
     445 
     446    def getSizeOfAxis(self,axis): 
     447        axisSize=self.file.axes[axis].length 
     448        return axisSize 
Note: See TracChangeset for help on using the changeset viewer.