Changeset 2863


Ignore:
Timestamp:
31/08/07 14:24:41 (12 years ago)
Author:
domlowe
Message:

adding bounding box class which represents spatial, temporal bbox + crs

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

Legend:

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

    r2758 r2863  
    1212def getAllowedSubsettings(self): 
    1313    return ['none'] 
    14  
    1514 
    1615def getDomainUnits(self): 
     
    2928    return None 
    3029 
     30def getBoundingBox(self): 
     31    return None 
    3132 
    3233def getSliceIndices(self, selection): 
  • TI02-CSML/trunk/csml/API/ops_Dataset.py

    r2692 r2863  
    8989                return extract  
    9090 
     91def getCSMLBoundingBox(self): 
     92    #returns a complete boundingBox object including temporal domain and crs 
     93    if hasattr(self.featureCollection, 'boundedBy'): 
     94        return csml.API.csmlbbox.CSMLBoundingBox(self.featureCollection.boundedBy) 
     95    else: 
     96        return None 
     97 
     98 
    9199def getBoundingBox(self): 
    92100    ''' get boundingBox, returns the boundingBox of the CSMLFeatureCollection (assumes there is only one...)''' 
  • TI02-CSML/trunk/csml/API/ops_GridSeriesFeature.py

    r2758 r2863  
    2020    return ['subsetToGridSeries', 'subsetToProfileSeries']  #other operations 
    2121 
    22  
    23  
    24  
     22def getCSMLBoundingBox(self): 
     23    #returns a complete boundingBox object including temporal domain and crs 
     24    if hasattr(self.value.gridSeriesDomain, 'boundedBy'): 
     25        return csml.API.csmlbbox.CSMLBoundingBox(self.featureCollection.boundedBy) 
     26    else: 
     27        return None 
     28 
     29def getBoundingBox(self): 
     30    bbox=self.value.gridSeriesDomain 
     31    try: 
     32        lower1=eval(bbox.boundedBy.lowerCorner.CONTENT.split()[0]) 
     33        lower2=eval(bbox.boundedBy.lowerCorner.CONTENT.split()[1]) 
     34        upper1=eval(bbox.boundedBy.upperCorner.CONTENT.split()[0]) 
     35        upper2=eval(bbox.boundedBy.upperCorner.CONTENT.split()[1]) 
     36        return [lower1,lower2,upper1,upper2] 
     37    except: 
     38        return None 
     39     
     40     
    2541def getDomain(self): 
    2642    #returns domain as a dictionary of ordinates {name: [values], ...} 
  • TI02-CSML/trunk/csml/testfiles/gridseries/subset.py

    r2758 r2863  
    4242 
    4343#define a selection (based on the domain) 
    44 subsetDictionary={} 
    45 #subsetDictionary['time']=('2794-12-1T0:0:0.0', '2804-12-1T0:0:0.0') 
    46 subsetDictionary['time']='2704-12-01T00:00:00.0' 
    47 #subsetDictionary['latitude']=(-90,60) 
     44#subsetDictionary={} 
     45##subsetDictionary['time']=('2794-12-1T0:0:0.0', '2804-12-1T0:0:0.0') 
     46#subsetDictionary['time']='2704-12-01T00:00:00.0' 
     47##subsetDictionary['latitude']=(-90,60) 
     48##subsetDictionary['longitude']=(-31.1265,30.258) 
     49#subsetDictionary['latitude']=(-5,5) 
    4850#subsetDictionary['longitude']=(-31.1265,30.258) 
    49 subsetDictionary['latitude']=(-5,5) 
    50 subsetDictionary['longitude']=(-31.1265,30.258) 
    5151#request subsetted data from features (can set paths here) and add to container 
    5252#subset a feature 
     
    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='2704-12-01T00:00:00.0')) 
     57csmlContainer.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 
    5959##subset another feature (in fact it's the same feature again, but this time subsetting to a profileseries) 
Note: See TracChangeset for help on using the changeset viewer.