Changeset 3704 for TI02-CSML


Ignore:
Timestamp:
31/03/08 14:52:45 (11 years ago)
Author:
domlowe
Message:

Added Ag's file cache code to DataInterface?. The Data Interface is read only

Location:
TI02-CSML/trunk/csml
Files:
1 added
4 edited

Legend:

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

    r3584 r3704  
    99import csml.csmllibs.csmlcrs 
    1010import csmlutils 
     11import os 
    1112 
    1213def testmethod(self): 
     
    350351 
    351352    odir=outputdir 
    352     profileSeries, pSfile, descriptor=self.subsetToProfileSeries(odir, ncname, **kwargs)    
     353    tmpfile= csml.csmllibs.csmlextra.getRandomID()+'.nc' 
     354    profileSeries, pSfile, descriptor=self.subsetToProfileSeries(odir, tmpfile, **kwargs)    
    353355    del kwargs['latitude']    #TODO - need to remove excess kwargs based on the domain of the temporary profileSeries feature 
    354356    del kwargs['longitude'] 
    355357    subsettedFeature, pathToSubsetNetCDF, descriptor =profileSeries.subsetToProfile(odir,ncname, **kwargs)     
     358    tmpfile=odir + '/' + tmpfile 
     359    os.remove(tmpfile) 
    356360    return subsettedFeature, pathToSubsetNetCDF, descriptor 
    357361 
     
    364368    @param kwargs:      subset selection by axis name. 
    365369    @return:     subsettedFeature (PointSeriesFeature instance)  pathToSubsetNetCDF (filepath), descriptor (array descriptor instance)''' 
    366      
    367     profileSeries, pSfile, descriptor =self.subsetToProfileSeries(outputdir, ncname, **kwargs)    
     370    tmpfile= csml.csmllibs.csmlextra.getRandomID()+'.nc' 
     371    profileSeries, pSfile, descriptor =self.subsetToProfileSeries(outputdir, tmpfile, **kwargs)    
    368372    del kwargs['latitude']    #TODO - need to remove excess kwargs based on the domain of the temporary profileSeries feature 
    369373    del kwargs['longitude'] 
    370374    subsettedFeature, pathToSubsetNetCDF, descriptor=profileSeries.subsetToPointSeries(outputdir, ncname, **kwargs)     
     375    tmpfile=outputdir + '/' + tmpfile 
     376    os.remove(tmpfile) 
    371377    return subsettedFeature, pathToSubsetNetCDF, descriptor 
  • TI02-CSML/trunk/csml/csmllibs/__init__.py

    r2767 r3704  
    1414import csmlxlink 
    1515import standardnames 
    16  
  • TI02-CSML/trunk/csml/csmllibs/csmldataiface.py

    r3627 r3704  
    1212************************************************************************************** 
    1313''' 
     14 
     15#caching module: 
     16from open_file_cache import OpenFileCache  
    1417 
    1518import pdb 
     
    4649    pass 
    4750 
     51cache=OpenFileCache() 
     52cache.limit=1000 
    4853 
    4954class DataInterface(object): 
     
    383388        ''' open file''' 
    384389        self._filename=filename 
    385         self.file=cdms.open(filename) 
    386          
     390        self.file=cache.openFile(cdms.open,filename) 
    387391        #now we have the file name can properly determine extractType/Prefix 
    388392        fileExtension = str(filename)[-3:] 
     
    402406            self.extractType = 'NetCDFExtract'  #okay this isn't true, but ok for testing 
    403407            self.extractPrefix = '_ncextract__'  
     408     
     409    def closeFile(self): 
     410        pass #let the cache manage this 
    404411     
    405412    def getListOfAxes(self): 
  • TI02-CSML/trunk/csml/csmllibs/netCDFWriter.py

    r3627 r3704  
    1010        #initiates a new NetCDF file 
    1111        self.nc=cdms.open(fileName,'w') 
    12      
     12 
    1313    def setGlobalAttributes(self, **kwargs): 
    1414        #sets global attributes 
Note: See TracChangeset for help on using the changeset viewer.