Changeset 2208


Ignore:
Timestamp:
26/02/07 14:55:05 (12 years ago)
Author:
domlowe
Message:

fixes to do with arrays/lists/nearestneighbours

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

Legend:

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

    r2206 r2208  
    3737        with a message describing the change. 
    3838        """ 
    39         #import cdms 
     39        print 'new' 
     40        print type(value)  
     41        print value     
    4042        rtMessage="" 
    4143        newValue=None 
    42                  
     44         
    4345        def __fixTimes(value, axisValues): 
    4446            newValue = csml.csmllibs.csmltime.getTimeAsValue(value) 
     
    8183            if newValue==None: 
    8284                rtMessage="%s axis selected value '%s' nudged to nearest value in real axis '%s' ;" % (axisType, value, newValue)        
    83         #        print rtMessage                 
    84         if type(newValue) is float: 
     85        #        print rtMessag 
     86        if type(newValue) is float: 
    8587            if len(str(int(newValue))) ==14: # it's a time 
    8688                print newValue 
    8789                newValue=csml.csmllibs.csmltime.convertValueToCSML(newValue)    
    88         return (newValue)                             
     90        print type(newValue) 
     91        print newValue 
     92        return (newValue)                             
  • TI02-CSML/trunk/csml/API/genSubset.py

    r2206 r2208  
    1313        #handle single values 
    1414        if type(kwargs[key]) is not tuple: 
    15             nearestNeighbour=csml.API.csmlutils.nudgeSingleValuesToAxisValues(kwargs[key],domain[gridnames[key]]) 
     15            if type(domain[gridnames[key]]) is not list: 
     16                axeslist=domain[gridnames[key]].tolist() 
     17            else: 
     18                axeslist = domain[gridnames[key]] 
     19            nearestNeighbour=csml.API.csmlutils.nudgeSingleValuesToAxisValues(kwargs[key],axeslist) 
    1620            if nearestNeighbour is not None: 
    1721                kwargs[key]=nearestNeighbour     
  • TI02-CSML/trunk/csml/csmllibs/csmldataiface.py

    r2196 r2208  
    447447                        subset=subset1 
    448448        if type(subset) is not cdms.tvariable.TransientVariable: 
     449            print kwargs 
     450            #kwargs['longitude']=45 
    449451            subset=self.file(self.varobj.id,**kwargs) 
    450452        return subset 
  • TI02-CSML/trunk/csml/testfiles/apicalls.py

    r2207 r2208  
    4545#request subsetted data from features (can set paths here) and add to container 
    4646#subset a feature 
    47 csmlContainer.add(feature.subsetToGridSeries(ncpath='myfile.nc',**subsetDictionary)) 
     47#csmlContainer.add(feature.subsetToGridSeries(ncpath='myfile.nc',**subsetDictionary)) 
    4848#subset another feature (in fact it's the same feature again, but it proves the concept) 
    4949subsetDictionary['t']=('2794-12-1T0:0:0.0','2795-12-1T0:0:0.0') 
    50 subsetDictionary['latitude']=(75) 
    51 subsetDictionary['longitude']=(41.25,45) 
     50subsetDictionary['latitude']=(75.) 
     51subsetDictionary['longitude']=(48.8) 
    5252csmlContainer.add(feature.subsetToProfileSeries(ncpath='myfile2.nc',**subsetDictionary)) 
    5353 
Note: See TracChangeset for help on using the changeset viewer.