Changeset 1415 in lmdz_wrf for trunk/tools
- Timestamp:
- Jan 18, 2017, 8:06:29 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r1411 r1415 14718 14718 quit(-1) 14719 14719 14720 if gen.searchInlist(varo.ncattrs(), 'missing_value'): 14720 varo[:] = newvarvals[:] 14721 varattrs = varo.ncattrs() 14722 print 'varattrs 1:', varattrs 14723 14724 if gen.searchInlist(varattrs, 'missing_value'): 14721 14725 missval = varo.getncattr('missing_value') 14722 14726 difvals = fval*10.**(-np.log10(valchk)) - missval*10.**(-np.log10(missval)) … … 14726 14730 print ' renaming missing_value' 14727 14731 varo.delncattr('missing_value') 14728 set_attribute(varo, '_FillValue', fval) 14729 else:14730 14732 14733 if not gen.searchInlist(varattrs, '_FillValue'): 14734 set_attribute(varo, '_FillValue', fval) 14731 14735 else: 14736 varo.delncattr('_FillValue') 14732 14737 set_attribute(varo, '_FillValue', fval) 14733 14734 varo[:] = newvarvals14735 14738 14736 14739 onc.sync() … … 18422 18425 sortedwgt.sort(reverse=True) 18423 18426 18424 # print fname + '; Lluis icv:', icv ,' _____', Nwgt[icv]18425 18427 for isp in range(Nwgt[icv]): 18426 18428 dictslice[ydn] = iy + int(ijcurv[icv,0,isp]) … … 18428 18430 varslice, dimvarvals = SliceVarDict(ov, dictslice) 18429 18431 iwgt = sortedwgt[isp] 18430 curvevar[...,icv] = curvevar[...,icv] + ov[tuple(varslice)]*iwgt 18431 # print ' isp:', isp, 'iwgt:', iwgt, '<>', iy + int(ijcurv[icv,0,isp]), \ 18432 # ix + int(ijcurv[icv,1,isp]), 'ival:', ov[tuple(varslice)][0,0], 'curvevar:', curvevar[0,0,icv] 18432 vaL = ov[tuple(varslice)]*iwgt 18433 18434 # Is the variable masked? 18435 if type(ov[:]) == type(gen.mamat): 18436 curvevar[...,icv] = np.where(ov[:].mask[tuple(varslice)], \ 18437 gen.fillValueF, curvevar[...,icv] + vaL) 18438 else: 18439 curvevar[...,icv] = curvevar[...,icv] + ov[tuple(varslice)]*iwgt 18433 18440 18434 18441 return curvevar
Note: See TracChangeset
for help on using the changeset viewer.