Changeset 2101 in lmdz_wrf
- Timestamp:
- Aug 25, 2018, 10:58:42 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r2097 r2101 11115 11115 return 11116 11116 11117 def insert_variable(onc, varn, varv, vardims, varvdims, onewnc ):11117 def insert_variable(onc, varn, varv, vardims, varvdims, onewnc, fill=None): 11118 11118 """ Function to insert a variable in an existing file 11119 11119 insert_variable(onc, varn, varv, vardims, onewnc) … … 11124 11124 [varvdims]= name of the variables with the values of the dimensions 11125 11125 [onewnc]= object of the new file 11126 [fill]= fill value (None for no fill_value) 11126 11127 """ 11127 11128 … … 11172 11173 else: 11173 11174 newdim = onewnc.createDimension(dmn,len(onc.dimensions[dmn])) 11174 11175 newvar = onewnc.createVariable(ivdim, refvdimv.dtype, \ 11176 (refvdimv.dimensions)) 11175 11176 newvar = onewnc.createVariable(ivdim, refvdimv.dtype, (refvdimv.dimensions)) 11177 11177 varattrs = refvdimv.ncattrs() 11178 11178 newvar[:] = refvdimvals … … 11196 11196 newvar = onewnc.variables[varvalues[0]] 11197 11197 else: 11198 newvar = onewnc.createVariable(varvalues[0], 'f4', (vardims)) 11198 if fill is None: 11199 newvar = onewnc.createVariable(varvalues[0], 'f4', (vardims)) 11200 else: 11201 newvar = onewnc.createVariable(varvalues[0], 'f4', (vardims), \ 11202 fill_value=fill) 11199 11203 newattr = basicvardef(newvar, varvalues[1], varvalues[4].replace('|',' '), \ 11200 11204 varvalues[5])
Note: See TracChangeset
for help on using the changeset viewer.