Changeset 552 in lmdz_wrf for trunk/tools
- Timestamp:
- Jul 1, 2015, 1:33:21 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r551 r552 16188 16188 newdim = onewfile.createDimension('time', None) 16189 16189 16190 # Variable time 16191 newvar = onewfile.createVariable('time', 'f8', tuple(newdimns)) 16192 newvar[:] = newtime 16193 basicvardef(newvar, 'time', 'time', tunits) 16194 16190 16195 splitS = seltimes.replace(',','') 16191 16196 … … 16249 16254 newvar[:] = newvarv 16250 16255 onewfile.sync() 16251 else: 16252 newvar = oVn 16256 elif Vn != tvdim: 16257 for dvn in Vndims: 16258 if not searchInlist(onewfile.dimensions,dvn): 16259 dsize = len(of.dimensions[dvn]) 16260 newdim = onewfile.createDimension(dvn, dsize) 16261 # From http://guziy.blogspot.fr/2014/01/netcdf4-python-copying-variables-from.html 16262 vartype = oVn.dtype 16263 newvar = onewfile.createVariable(Vn, vartype, Vndims) 16264 for attrn in oVn.ncattrs(): 16265 attrv = oVn.getncattr(attrn) 16266 newattr = set_attribute(newvar, attrn, attrv) 16267 16268 newvar[:] = oVn[:] 16253 16269 16254 16270 # Variable time 16255 newvar = onewfile. createVariable('time', 'f8', tuple(newdimns))16271 newvar = onewfile.variables['time'] 16256 16272 newvar[:] = newtime 16257 basicvardef(newvar, 'time', 'time', tunits)16258 16273 16259 16274 # Variables selection
Note: See TracChangeset
for help on using the changeset viewer.