Ignore:
Timestamp:
06/02/07 15:43:35 (13 years ago)
Author:
domlowe
Message:

units and missing values now working properly in subsetgridseries

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/csml/csmllibs/netCDFWriter.py

    r2095 r2112  
    3636        pass 
    3737     
    38     def addVariable(self,data, variableName,axesList,  **kwargs): 
     38    def addVariable(self,data, variableName,axesList, fillvalue,  **kwargs):         
    3939        #creates a new variable containing data with named attributes from **kwargs 
    4040        dataarray=MV.array(data) 
     
    5050                        dataarray.setAxis(axisCount,ax) 
    5151                        axisCount = axisCount +1 
     52        setattr(dataarray, 'missing_value' ,fillvalue) 
    5253        self.nc.write(dataarray) 
    5354 
    54     def genWriteVar(self,varid, ordinates, times, calunits, caltype, axisorder, fulldata): 
     55    def genWriteVar(self,varid, ordinates, times, calunits, caltype, axisorder, unitlist, fulldata, fillvalue): 
    5556        floatTimes=[] 
    5657        for time in times: 
     
    7475                name='latitude' 
    7576            else: 
    76                 name=ord.coordAxisLabel.CONTENT 
    77             self.addAxis(name,vals,isLon=lon,isLat=lat,units='')#to do, units attribute for CF compliance 
    78         if len(ordinates)==3: 
    79             axes=['time',axisorder[1],axisorder[2]] 
    80         elif len(ordinates)==2: 
    81             axes=['time',axisorder[1]] 
    82         self.addVariable(fulldata,varid, axes,units='') #to do, units attribute for CF compliance 
     77                name=ord.coordAxisLabel.CONTENT    
     78            self.addAxis(name,vals,isLon=lon,isLat=lat,units=unitlist[axisorder.index(name)])#to do, units attribute for CF compliance 
     79        self.addVariable(fulldata,varid, axisorder, fillvalue, units=unitlist[-1] ) #to do, units attribute for CF compliance 
    8380                 
    8481         
Note: See TracChangeset for help on using the changeset viewer.