Changeset 2846 in lmdz_wrf


Ignore:
Timestamp:
Jul 7, 2020, 6:48:20 AM (4 years ago)
Author:
lfita
Message:

Fixing? mask_var

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r2845 r2846  
    44474447    attr = newvar.setncattr('mask', 'variable masked using ' + values.split(':')[2]+ \
    44484448      ' of variable ' + maskvarn + ' from file ' + maskfilename)
     4449    attr = set_attributek(newvar, 'mask_value', maskval, 'F')
    44494450    newvar[:] = varobj[:]
    44504451
     
    44764477
    44774478    #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)
    44794481
    44804482    if maskvalue != 'mask':
    44814483        maskTOuse = ma.masked_equal(maskvalues, maskval)
     4484        print 'Lluis maskTOuse', maskTOuse.mask
    44824485        maskTOusev = maskTOuse.mask
    44834486    else:
    44844487        maskTOusev = maskvalues.mask
    44854488
     4489    print 'Lluis runningsize', runningsize
    44864490    for ir in range(runningsize):
    44874491        islice = slices[ir]
    44884492        varvals = varobj[tuple(islice)]
    44894493        maskvarvals = np.where(maskTOusev, fillValue, varvals)
     4494        print islice, newvar.name, 'Lluis maskvarvals', maskvarvals
    44904495        newvar[tuple(islice)] = maskvarvals
     4496    newvar[:] = np.where(maskvalues == maskval, fillValue, varobj[:])
    44914497
    44924498    ncfnew.sync()
     4499   
     4500    add_globattrs(ncf,ncfnew,'all')
     4501    add_global_PyNCplot(ncfnew, 'nc_var_tools', fname, '1.1')
     4502   
    44934503    ncfnew.close()
    44944504    ncf.close()
Note: See TracChangeset for help on using the changeset viewer.