Changeset 2562


Ignore:
Timestamp:
08/06/07 10:04:31 (12 years ago)
Author:
domlowe
Message:

subsetting to point basic code added

Location:
TI02-CSML/trunk/csml/API
Files:
3 edited

Legend:

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

    r2548 r2562  
    4343 
    4444##PointSeriesFeature methods: 
    45 addMethods(csml.parser.PointSeriesFeature, [ops_PointSeriesFeature.testmethod,ops_PointSeriesFeature.getDomain, ops_PointSeriesFeature.subsetToPointSeries,  ops_PointSeriesFeature.getAllowedSubsettings]) 
     45addMethods(csml.parser.PointSeriesFeature, [ops_PointSeriesFeature.testmethod,ops_PointSeriesFeature.getDomain, ops_PointSeriesFeature.subsetToPointSeries,ops_PointSeriesFeature.subsetToPoint,  ops_PointSeriesFeature.getAllowedSubsettings]) 
    4646 
    4747##ProfileFeature methods: 
  • TI02-CSML/trunk/csml/API/ops_FileExtract.py

    r2548 r2562  
    123123    fillvalue=DI.getVariableAttribute('_FillValue') 
    124124    axisorder=DI.getVariableAxes() 
    125     units=[] 
    126     for axis in axisorder:     
    127         DI.setAxis(axis) 
    128         units.append(DI.getAxisAttribute('units'))     
    129125       
    130126    DI.closeFile() 
     
    133129    except: 
    134130        result =data 
    135     return result, fillvalue, units 
     131    return result, fillvalue 
    136132         
    137133def __calendar(file,timedim): 
  • TI02-CSML/trunk/csml/API/ops_PointSeriesFeature.py

    r2550 r2562  
    4141    pathToSubsetNetCDF=ncpath 
    4242    if type(times) is str: 
    43         selection = csml.csmllibs.csmlextra.listify(times) 
     43        selection = tuple(csml.csmllibs.csmlextra.listify(times)) 
    4444    else: 
    45         selection = times 
    46      
     45        selection = times   
    4746    tlist=[]     
    4847    for val in self.value.pointSeriesDomain.timePositionList.CONTENT.split(): 
    4948        tlist.append(val) 
    50          
    5149    
    5250    indices=[] 
     
    6866        for domaintime in tlist: 
    6967            if selection[0] == domaintime: 
     68                 
    7069                minIndex=tlist.index(domaintime) 
    7170                maxIndex=minIndex 
    72                 selectedTimes=selection[0] 
     71                selectedTimes=selection 
    7372                break 
    7473     
     
    8079     
    8180    fextract=self.value.rangeSet.arrayDescriptor.components 
    82     data, fillvalue, units=fextract.getDataFromChunks(minIndex, maxIndex) 
     81    uom = self.value.rangeSet.arrayDescriptor.uom 
     82    data, fillvalue=fextract.getDataFromChunks(minIndex, maxIndex) 
    8383     
     84    units=[uom.CONTENT] 
    8485    
    8586    #Now write out the CSML Feature: 
     
    121122     
    122123    #the parameter of the feature is of type Phenomenon, here href creates "xlink:href=..." 
    123     param=csml.parser.Phenomenon(href='CFStandardNames.xml#temperature') 
     124    param=self.parameter 
    124125     
    125      
    126      
     126       
    127127    #create a stand alone pointseries feature containing this coverage 
    128128    csmlWrap=csml.csmllibs.csmlfeaturewrap.CSMLWrapper() 
    129129    subsettedFeature=csmlWrap.createPointSeriesFeature(value=cvg,parameter=param,location=self.location,featureID=self.id,description=self.description) 
    130130     
    131      
    132      
     131       
    133132     
    134133    #Now write out the NetCDF File:    
     
    141140     
    142141    floatTimes=[] 
    143     #determine base units for times: 
    144     tOne=csml.csmllibs.csmltime.getCDtime(times[0]) 
     142     
     143    tOne=csml.csmllibs.csmltime.getCDtime(selection[0]) 
    145144    tbase=csml.csmllibs.csmltime.getBaseUnits(tOne) 
    146145    for time in selectedTimes: 
     
    158157     
    159158     
     159def subsetToPoint(self, csmlpath=None, ncpath=None,time=None): 
     160    pseriesFeature, pathToSubsetNetCDF, descriptor=self.subsetToPointSeries(csmlpath,ncpath,time) 
     161             
     162    #now need to take this point series feature containing one time and rewrite it as a point feature. 
     163    pointFeature=csml.parser.PointFeature() 
     164    pointFeature.location=pseriesFeature.location 
     165    pointFeature.parameter=pseriesFeature.parameter 
    160166     
    161      
    162      
    163      
     167    return pointFeature, pathToSubsetNetCDF, descriptor 
Note: See TracChangeset for help on using the changeset viewer.