Changeset 2846 in lmdz_wrf for trunk/tools/nc_var_tools.py
- Timestamp:
- Jul 7, 2020, 6:48:20 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r2845 r2846 4447 4447 attr = newvar.setncattr('mask', 'variable masked using ' + values.split(':')[2]+ \ 4448 4448 ' of variable ' + maskvarn + ' from file ' + maskfilename) 4449 attr = set_attributek(newvar, 'mask_value', maskval, 'F') 4449 4450 newvar[:] = varobj[:] 4450 4451 … … 4476 4477 4477 4478 #slices = gen.provide_slices(varinf.dimns, varinf.dims, list(varmaskinf.dimns)) 4478 slices = gen.provide_slices(varinf.dimns, varinf.dims, vdimns) 4479 print varinf.dimns, varinf.dims, 'Lluis vdimns', vdimns 4480 slices = gen.provide_slices(list(varinf.dimns), varinf.dims, vdimns) 4479 4481 4480 4482 if maskvalue != 'mask': 4481 4483 maskTOuse = ma.masked_equal(maskvalues, maskval) 4484 print 'Lluis maskTOuse', maskTOuse.mask 4482 4485 maskTOusev = maskTOuse.mask 4483 4486 else: 4484 4487 maskTOusev = maskvalues.mask 4485 4488 4489 print 'Lluis runningsize', runningsize 4486 4490 for ir in range(runningsize): 4487 4491 islice = slices[ir] 4488 4492 varvals = varobj[tuple(islice)] 4489 4493 maskvarvals = np.where(maskTOusev, fillValue, varvals) 4494 print islice, newvar.name, 'Lluis maskvarvals', maskvarvals 4490 4495 newvar[tuple(islice)] = maskvarvals 4496 newvar[:] = np.where(maskvalues == maskval, fillValue, varobj[:]) 4491 4497 4492 4498 ncfnew.sync() 4499 4500 add_globattrs(ncf,ncfnew,'all') 4501 add_global_PyNCplot(ncfnew, 'nc_var_tools', fname, '1.1') 4502 4493 4503 ncfnew.close() 4494 4504 ncf.close()
Note: See TracChangeset
for help on using the changeset viewer.