Changeset 2665


Ignore:
Timestamp:
29/06/07 12:27:38 (12 years ago)
Author:
domlowe
Message:

used dictionary to store fileextract info that was getting read from disk each time

Location:
TI02-CSML/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/XMLSchemas/moles/ndgmetadata1.3.xsd

    r2426 r2665  
    506506                        </xs:element> 
    507507                </xs:sequence> 
    508         </xs:complexType> 
     508        </xs:complexType>        
    509509        <xs:complexType name="dgPolygon2DType"> 
    510510                <xs:annotation> 
  • TI02-CSML/trunk/csml/API/csmlContainer.py

    r2569 r2665  
    55    '''container for (optional) shared variables (eg outputdir)''' 
    66    OUTPUTDIR=None 
    7      
     7    CACHE={} #cache used for storing fileextract domain data, eg lat lon values, that are often reused 
    88 
    99class Container(object): 
  • TI02-CSML/trunk/csml/API/ops_FileExtract.py

    r2633 r2665  
    3333        directory=csml.API.csmlContainer.globalContainer.OUTPUTDIR 
    3434    else: 
    35         directory=None 
     35        directory=None  
     36         
     37         
     38    #if fileposition is None, then this may be stored in the cache already. 
     39    try: 
     40        [dataArray, fillvalue, axisorder, units]=csml.API.csmlContainer.globalContainer.CACHE[self.id] 
     41        return dataArray, fillvalue, axisorder, units 
     42    except: 
     43        pass 
    3644     
    3745    #file position defines the position of the filename if a list of filenames exists 
     
    8492            units.append(DI.getAxisAttribute('units')) 
    8593    DI.closeFile() 
     94     
     95    #if fileposition is none, add to cache for retrieval by id later: 
     96    csml.API.csmlContainer.globalContainer.CACHE[self.id]=[dataArray, fillvalue, axisorder, units] 
     97     
    8698    return dataArray, fillvalue, axisorder, units 
    8799         
  • TI02-CSML/trunk/csml/API/ops_GridSeriesFeature.py

    r2597 r2665  
    6666        if hasattr(gridOrd.coordAxisValues, 'insertedExtract'): 
    6767            self.domain[name], fill, axisorder, units=gridOrd.coordAxisValues.insertedExtract.getData() 
     68            #add to cache 
    6869        else:             
    6970            valList=[] 
  • TI02-CSML/trunk/csml/csmllibs/csmlcrs.py

    r2584 r2665  
    133133            #at the moment a simple test on number of dimensions works, but need to make this more generic. 
    134134            for psystem in self.pseudosystems: 
    135                 if len(self.pseudosystems[psystem].axes) == len (labellist): 
    136                     return self.pseudosystems[psystem] 
     135                try: 
     136                    if len(self.pseudosystems[psystem].axes) == len (labellist): 
     137                        return self.pseudosystems[psystem] 
     138                except: 
     139                    pass 
    137140            else: 
    138141                return self.systems['ndg:crs:unknown'] 
Note: See TracChangeset for help on using the changeset viewer.