Changeset 3050 for TI02-CSML


Ignore:
Timestamp:
27/11/07 08:40:47 (12 years ago)
Author:
domlowe
Message:

handling standard name in phenomenon

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

Legend:

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

    r3022 r3050  
    2727import ops_TrajectoryFeature 
    2828import ops_RaggedSectionFeature 
     29import ops_Phenomenon 
    2930import csmlContainer 
    3031import types 
     
    4344 
    4445 
    45 operationsMap={csml.parser.Dataset:ops_Dataset, csml.parser.FileExtract:ops_FileExtract, csml.parser.RawFileExtract: ops_RawFileExtract, csml.parser.AbstractFeature:ops_AbstractFeature, csml.parser.GridSeriesFeature:ops_GridSeriesFeature, csml.parser.GridFeature:ops_GridFeature, csml.parser.PointSeriesFeature:ops_PointSeriesFeature,csml.parser.ProfileSeriesFeature:ops_ProfileSeriesFeature,csml.parser.TrajectoryFeature:ops_TrajectoryFeature, csml.parser.RaggedSectionFeature:ops_RaggedSectionFeature} 
     46operationsMap={csml.parser.Dataset:ops_Dataset, csml.parser.FileExtract:ops_FileExtract, csml.parser.RawFileExtract: ops_RawFileExtract, csml.parser.AbstractFeature:ops_AbstractFeature, csml.parser.GridSeriesFeature:ops_GridSeriesFeature, csml.parser.GridFeature:ops_GridFeature, csml.parser.PointSeriesFeature:ops_PointSeriesFeature,csml.parser.ProfileSeriesFeature:ops_ProfileSeriesFeature,csml.parser.TrajectoryFeature:ops_TrajectoryFeature, csml.parser.RaggedSectionFeature:ops_RaggedSectionFeature, csml.parser.Phenomenon:ops_Phenomenon} 
    4647 
    4748 
  • TI02-CSML/trunk/csml/API/ops_GridSeriesFeature.py

    r2979 r3050  
    206206    for a in axisorder: 
    207207        axislist.append(self.gridnames[a]) 
    208     nc.genWriteVar(self.name.CONTENT,ords, times, caltype, axislist, units, fulldata, fillvalue) 
     208    stdname=param.getStandardName() 
     209    nc.genWriteVar(self.name.CONTENT,ords, times, caltype, axislist, units, stdname, fulldata, fillvalue) 
    209210    nc.closeFinishedFile() 
    210211    print 'NetCDF file written to %s'%pathToSubsetNetCDF 
     
    310311    for a in axisorder: 
    311312        axislist.append(self.gridnames[a]) 
    312  
    313     nc.genWriteVar(self.name.CONTENT,ords, times, caltype, axislist, units, fulldata, fillvalue, latitude=kwargs[latName], longitude=kwargs[lonName]) 
     313    stdname=param.getStandardName() 
     314    nc.genWriteVar(self.name.CONTENT,ords, times, caltype, axislist, units, stdname, fulldata, fillvalue, latitude=kwargs[latName], longitude=kwargs[lonName]) 
    314315    nc.closeFinishedFile() 
    315316     
  • TI02-CSML/trunk/csml/csmllibs/csmlfeaturetypes.py

    r3046 r3050  
    223223            sname = None 
    224224        else: 
    225             sname='http://cf-pcmdi.llnl.gov/%s'%sn         
     225            sname='http://cf-pcmdi.llnl.gov/standard_names/%s'%sn         
    226226        return sname 
    227227     
  • TI02-CSML/trunk/csml/csmllibs/netCDFWriter.py

    r2633 r3050  
    2828        if isLon is not None: 
    2929            ax.designateLongitude() 
     30            setattr(ax, 'standard_name', 'longitude') 
    3031        elif isLat is not None: 
    3132            ax.designateLatitude() 
     33            setattr(ax, 'standard_name', 'latitude') 
    3234        elif isTime is not None: 
    3335            ax.designateTime() 
     36            setattr(ax, 'standard_name', 'time') 
    3437        for key in kwargs: 
    3538            setattr(ax, key,kwargs[key]) 
     
    5356         
    5457         
    55     def addVariable(self,data, variableName,axesList, fillvalue, **kwargs):         
     58    def addVariable(self,data, variableName,axesList, fillvalue, stdname=None, **kwargs):         
    5659        #creates a new variable containing data with named attributes from **kwargs        
    5760              
     
    7780                        dataarray.setAxis(axisCount,ax)                        
    7881                        axisCount = axisCount +1       
    79         setattr(dataarray, 'missing_value' ,fillvalue) 
     82        #missing_value deprecated but in common use; 
     83        #setattr(dataarray, 'missing_value' ,fillvalue) 
     84        setattr(dataarray, '_FillValue' ,fillvalue) 
     85        if stdname: 
     86            setattr(dataarray, 'standard_name' ,stdname) 
    8087        self.nc.write(dataarray) 
    8188 
    82     def genWriteVar(self,varid, ordinates, times, caltype, axisorder, unitlist, fulldata, fillvalue, **kwargs): 
     89    def genWriteVar(self,varid, ordinates, times, caltype, axisorder, unitlist, stdname, fulldata, fillvalue, **kwargs): 
     90         
     91        print varid 
     92        print ordinates 
     93        print times 
     94        print caltype 
     95        print axisorder 
     96        print unitlist 
     97        print stdname 
     98         
     99 
    83100        #**kwargs may contain additional axes not contained in a GridCoordinatesTable - e.g latitude, longitude may be stored in other attribute not in the rectified grid.      
    84101        axesdone=[] 
     
    131148                self.addAxis(name,vals,isLon=lon,isLat=lat,units=unitlist[position]) 
    132149                axesdone.append(name)         
    133         self.addVariable(fulldata,varid, axisorder, fillvalue, units=unitlist[-1] ) #to do, units attribute for CF compliance 
     150        self.addVariable(fulldata,varid, axisorder, fillvalue, units=unitlist[-1], stdname=stdname )  
    134151 
    135         for ax in self.axes: 
    136             if ax.id =='time': 
    137                 if self.nc.variables.has_key('time') is False: 
    138                     self.addTimeVariable(floatTimes) 
     152        #for ax in self.axes: #don't think this is needed! 
     153            #if ax.id =='time': 
     154                #if self.nc.variables.has_key('time') is False: 
     155                    #self.addTimeVariable(floatTimes) 
    139156         
    140157         
Note: See TracChangeset for help on using the changeset viewer.