Changeset 1895 in lmdz_wrf
- Timestamp:
- Apr 5, 2018, 6:36:02 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r1894 r1895 367 367 newattr = set_attribute(newvar, attrn, attrv) 368 368 369 newvar[:] = varo[:] 369 if np.prod(varo.shape) > 300*100*50: 370 if varo.shape[0] > 10: dd0=5 371 else: dd0=2 372 print infmsg 373 print ' ' + fname + ": huge variable of shape:", varo.shape, ' !!' 374 print ' filling by slices of ', dd0,' along first dimension of ' + \ 375 'length:', varo.shape[0] 376 fillshape = [dd0] + list(varo.shape[1:-1]) 377 fillm = np.zeros(tuple(fillshape), dtype=vartype) 378 dfill = varo.shape[0] 379 # Splitting 380 for iit in range(0,dd0*int(dfill/dd0),dd0): 381 tini = iit 382 tend = iit + dd0 383 newvar[tini:tend,:] = varo[tini:tend,:] 384 if tend != dfill-2: 385 tini = tend 386 tend = dfill 387 newvar[tini:tend,:] = varo[tini:tend,:] 388 389 else: 390 newvar[:] = varo[:] 370 391 371 392 nc.sync()
Note: See TracChangeset
for help on using the changeset viewer.