Changeset 1555


Ignore:
Timestamp:
05/10/06 16:23:02 (13 years ago)
Author:
domlowe
Message:

some changes to allow cdml to be used as data source, not working properly yet though

Location:
TI02-CSML/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/Examples/parsing/apicalls.py

    r1523 r1555  
    2222feature=csmldoc.getFeature(flist[4]) 
    2323 
    24 #feature 'bestname' 
     24f#eature 'bestname' 
    2525print feature.id 
    2626print feature.description 
  • TI02-CSML/trunk/Examples/scanning/mstconfig.cfg

    r1493 r1555  
    44 
    55[files] 
    6 root: /home/users/domlowe/SVNWorkingCopy/trunk/Scanner/msttest 
     6root: /home/users/domlowe/SVNWorkingCopy/trunk/Examples/scanning/msttest 
    77mapping: oneonly 
    88output:mstout.xml 
  • TI02-CSML/trunk/csml/API/csmlContainer.py

    r1523 r1555  
    5353        #need to think about whether it is best to append the file object or just a path to the file 
    5454        self.ncfiles.append(ncfile) 
    55      
     55 
     56         
    5657    def getContents(self): 
    5758        self.ds.arrayDescriptors=self.ad 
  • TI02-CSML/trunk/csml/csmllibs/csmldataiface.py

    r1466 r1555  
    4343                        return cdunifInterface() 
    4444                elif fileExtension == 'ctl': 
     45                        return cdunifInterface() 
     46                elif fileExtension == 'xml': 
    4547                        return cdunifInterface() 
    4648                else: 
     
    313315            self.extractType = 'GRIBExtract' 
    314316            self.extractPrefix = '_gribextract_' 
    315  
     317        elif fileExtension == 'xml':  
     318            self.extractType = 'NetCDFExtract'  #okay this isn't true, but ok for testing 
     319            self.extractPrefix = '_ncextract__'  
    316320    def getListOfAxes(self): 
    317321        axes=self.file.dimensions.keys() 
  • TI02-CSML/trunk/csml/csmllibs/csmldirectory.py

    r1462 r1555  
    33import nappy 
    44import sys 
     5import string 
    56 
    67class DirectoryTree(object): 
     
    99100        fileExtension = str(filename)[-3:] 
    100101        supported = False 
     102         
    101103        try: 
    102104            if fileExtension == '.nc': 
     
    106108            elif fileExtension == 'ctl': 
    107109                    supported = True 
     110            elif fileExtension == 'xml': 
     111            #this could be a CDML file. Only way to see is to open it. 
     112                f=open(filename, 'r') 
     113                f.readline() #read first line, now read docstring on second line 
     114                line2=f.readline() 
     115                if string.find(line2,'http://www-pcmdi.llnl.gov/software/cdms/cdml.dtd') > -1: 
     116                    supported = True 
     117                    f.close() 
    108118            elif nappy.readFFI(filename) in [1001,1010,1020,2010,2110,2160,2310,3010,4010]: 
    109119                    supported = True 
     
    111121                #the nappy.readFFI function can fail if permissions are wrong (for example) 
    112122                supported=False 
    113         return supported 
     123        return supported 
    114124                                 
    115125                                 
Note: See TracChangeset for help on using the changeset viewer.