Changeset 2974


Ignore:
Timestamp:
30/10/07 13:22:15 (12 years ago)
Author:
domlowe
Message:

removed some unused lines

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

Legend:

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

    r2779 r2974  
    1111    #e.g if 'latitude': (11) requested, latitude=12 may be the nearest value 
    1212    for key in kwargs: 
    13     #need to skip time axis 
    1413        #handle single values 
    1514        if type(kwargs[key]) is not tuple: 
     
    2120            if nearestNeighbour is not None: 
    2221                kwargs[key]=nearestNeighbour     
    23         else: 
    24             ##handle ranges 
    25             #tmpkey=[] 
    26             ##this finds the nearest neighbour without overstepping 0 (for longitude) 
    27             #if kwargs[key][0] > kwargs[key][1]:                                 
    28                 #nearestNeighbour=csml.API.csmlutils.nudgeSingleValuesToAxisValues(val, domain[key], minBound=kwargs[key][0], maxBound=0) 
    29                 #if nearestNeighbour is not None: 
    30                     #tmpkey.append(nearestNeighbour)    
    31                 #nearestNeighbour=csml.API.csmlutils.nudgeSingleValuesToAxisValues(val, domain[key], minBound=0, maxBound=kwargs[key][1]) 
    32                 #if nearestNeighbour is not None: 
    33                     #tmpkey.append(nearestNeighbour)    
    34                                   
    35             #else: 
    36                 tmpkey=[] 
    37                 for val in kwargs[key]: 
    38                     nearestNeighbour=csml.API.csmlutils.nudgeSingleValuesToAxisValues(val, domain[key], minBound=kwargs[key][0], maxBound=kwargs[key][1]) 
    39                     if nearestNeighbour is not None: 
    40                         tmpkey.append(nearestNeighbour)    
    41                 kwargs[key]=tuple(tmpkey)             
     22        else:                                  
     23            tmpkey=[] 
     24            for val in kwargs[key]: 
     25                nearestNeighbour=csml.API.csmlutils.nudgeSingleValuesToAxisValues(val, domain[key], minBound=kwargs[key][0], maxBound=kwargs[key][1])                 
     26                if nearestNeighbour is not None: 
     27                    tmpkey.append(nearestNeighbour)    
     28            kwargs[key]=tuple(tmpkey)             
    4229    return kwargs 
    4330 
     
    4633    time = name of time dimension 
    4734    times = string of times 
    48     '''    
    49      
     35    '''        
    5036    #reduce requests with same max and min eg (45,45) down to single value. 
    5137    for kw in kwargs: 
     
    285271    #if the request is in -ve,+ve eg (-30,30) but the data is in (0,360) need to handle this by changing the args. 
    286272    kwargs=csmlutils.fixLongitude(domain,kwargs) 
    287  
     273    
     274     
    288275    #if request doesn't match domain points find nearest neighbours 
    289276    kwargs=csml.API.genSubset.checkNeighbours(domain, **kwargs) 
    290     
    291      
    292      
    293277     
    294278    #get the name of the time axis in the coordinate reference system 
     
    311295    #set the reference system for the time axis 
    312296    caltype=_setCalendar(feature, timeName, gridordinates) 
    313      
    314297    try: 
    315298        timeSelection=kwargs[timeName] 
     
    317300        timeSelection=[] 
    318301     
    319     times=_getTimes(timeSelection, timeName,domain)     
     302    times=_getTimes(timeSelection, timeName,domain)         
    320303    return pathToSubsetNetCDF, kwargs, timeAxis,timeName, caltype, times 
  • TI02-CSML/trunk/csml/testfiles/gridseries/subset.py

    r2863 r2974  
    5555 
    5656    #csmlContainer.add(feature.subsetToGridSeries(outputdir,ncname='mygridseries.nc',**subsetDictionary)) 
    57 csmlContainer.add(feature.subsetToGridSeries(outputdir,ncname='mygridseries.nc',latitude=(-90,90), longitude=(-180,180),time=('2804-12-01T00:00:00.0','2904-12-01T00:00:00.0'))) 
     57#csmlContainer.add(feature.subsetToGridSeries(outputdir,ncname='mygridseries.nc',latitude=(-90,90), longitude=(-180,180),time=('2804-12-01T00:00:00.0','2904-12-01T00:00:00.0'))) 
    5858 
    59 ##subset another feature (in fact it's the same feature again, but this time subsetting to a profileseries) 
    60 #subsetDictionary={} 
    61 #subsetDictionary['time']=('2794-12-1T0:0:0.0','2904-12-1T0:0:0.0') 
    62 #subsetDictionary['latitude']=(75) 
    63 #subsetDictionary['longitude']=(45) 
     59csmlContainer.add(feature.subsetToGridSeries(outputdir,ncname='mygridseries.nc',latitude=(60), longitude=(180),time=('2804-12-01T00:00:00.0','2904-12-01T00:00:00.0'))) 
    6460 
    65 ###assigning profileseries feature to variable 
    66 ##print 'subset grid to profileseries' 
    67 #psfeature, file, descriptor =feature.subsetToProfileSeries(outputdir, ncname='myprofileseries.nc',**subsetDictionary) 
    68 #csmlContainer.add([psfeature,file, descriptor]) 
     61#subset another feature (in fact it's the same feature again, but this time subsetting to a profileseries) 
     62subsetDictionary={} 
     63subsetDictionary['time']=('2804-12-01T00:00:00.0','2904-12-01T00:00:00.0') 
     64subsetDictionary['latitude']=(75) 
     65subsetDictionary['longitude']=(45) 
     66 
     67##assigning profileseries feature to variable 
     68#print 'subset grid to profileseries' 
     69psfeature, file, descriptor =feature.subsetToProfileSeries(outputdir, ncname='myprofileseries.nc',**subsetDictionary) 
     70csmlContainer.add([psfeature,file, descriptor]) 
     71 
     72#csmlContainer.add(feature.subsetToProfileSeries(outputdir,ncname='myprofileseries.nc',latitude=(75), longitude=(45),time=('2804-12-01T00:00:00.0','2904-12-01T00:00:00.0'))) 
    6973 
    7074#Now subset this New ProfileSeries feature into a Profile feature 
Note: See TracChangeset for help on using the changeset viewer.