Changeset 751 in lmdz_wrf
- Timestamp:
- May 4, 2016, 11:46:34 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r750 r751 11947 11947 idim = 0 11948 11948 for dim in list(ovar.dimensions): 11949 if not searchInlist(seldims,dim):11949 if not gen.searchInlist(seldims,dim): 11950 11950 newshape.append(ovar.shape[idim]) 11951 11951 noloopdims.append(dim) … … 11967 11967 idim = 0 11968 11968 for dim in ovar.dimensions: 11969 if searchInlist(dloop,dim):11969 if gen.searchInlist(dloop,dim): 11970 11970 slicevals.append(dloopindex[idim]) 11971 11971 else: … … 12263 12263 + varname2 + ' as space weights' 12264 12264 if len(loopshape) == 1: 12265 newvals = np.ones((loopshape[0]), dtype=np.float)* fillValueF12265 newvals = np.ones((loopshape[0]), dtype=np.float)*gen.fillValueF 12266 12266 for id1 in range(loopshape[0]): 12267 12267 slicevalues = SliceVar(iovar,dimsloop,[id1]) … … 12272 12272 elif len(loopshape) == 2: 12273 12273 newvals = np.ones((loopshape[0],loopshape[1]),dtype=np.float)* \ 12274 fillValueF12274 gen.fillValueF 12275 12275 for id1 in range(loopshape[0]): 12276 12276 for id2 in range(loopshape[1]): … … 12282 12282 elif len(loopshape) == 3: 12283 12283 newvals = np.ones((loopshape[0],loopshape[1],loopshape[2]), \ 12284 dtype=np.float)* fillValueF12284 dtype=np.float)*gen.fillValueF 12285 12285 for id1 in range(loopshape[0]): 12286 12286 for id2 in range(loopshape[1]): … … 12314 12314 ivarwgtv = np.abs(np.cos(latv*np.pi/180.)) 12315 12315 TOTsumwgt = np.sum(ivarwgtv) 12316 12317 print 'Lluis len(looopshape):', len(loopshape) 12316 12318 if len(loopshape) == 1: 12317 12319 newvals = np.ones((loopshape[0]), dtype=np.float)*fillValueF … … 12366 12368 ## 12367 12369 newvar = onewnc.createVariable(varn + 'spaceweightsum', 'f4', tuple(dimsloop), \ 12368 fill_value= fillValueF)12370 fill_value=gen.fillValueF) 12369 12371 basicvardef(newvar, varn + 'spaceweightsum', 'space summed ' + varn + ' ' + \ 12370 12372 longvarname, iovar.getncattr('units')) … … 12374 12376 12375 12377 newvar = onewnc.createVariable(varn + 'spaceweightmean', 'f4', tuple(dimsloop), \ 12376 fill_value= fillValueF)12378 fill_value=gen.fillValueF) 12377 12379 basicvardef(newvar, varn + 'spaceweightmean', 'space weighted ' + varn + ' ' + \ 12378 12380 longvarname, iovar.getncattr('units')) … … 12388 12390 newdim = onewnc.createDimension(xdimname, outweightvals.shape[1]) 12389 12391 newvar = onewnc.createVariable('spatialweight', 'f4',tuple([ydimname, xdimname]),\ 12390 fill_value= fillValueF)12392 fill_value=gen.fillValueF) 12391 12393 basicvardef(newvar, 'spatialweight', 'space weight ' + longvarname, '-') 12392 12394 newvar[:] = outweightvals … … 12421 12423 onewnc.sync() 12422 12424 onewnc.close() 12423 12424 12425 12425 12426 print fname + ": Successfull written of file: '" + ofile + "' !!"
Note: See TracChangeset
for help on using the changeset viewer.