Changeset 287 in lmdz_wrf for trunk/tools/nc_var_tools.py
- Timestamp:
- Feb 25, 2015, 3:43:56 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r286 r287 10370 10370 gtrajvals = np.zeros((Ttraj,3), dtype=int) 10371 10371 trajvals = np.zeros((Ttraj,3), dtype=np.float) 10372 circdist = np.zeros((Ttraj, dimy, dimx), dtype=np.float) 10372 10373 10373 10374 it = 0 … … 10456 10457 10457 10458 # circle values 10458 circdist = radius_dist(dimy, dimx, gtrajvals[it,2],gtrajvals[it,1])10459 circdist[it,:,:] = radius_dist(dimy,dimx,gtrajvals[it,2],gtrajvals[it,1]) 10459 10460 10460 10461 if gtrajvals[it,2]-Nrad < 0 or gtrajvals[it,2]+Nrad + 1 > dimy + 1 \ … … 10538 10539 if Nvardims == 4: 10539 10540 # Too optimistic, but at this stage... 10540 dimz = varobj.shape[1]10541 10542 10541 if not objofile.dimensions.has_key('z'): 10543 10542 varzobj = objfile.variables[zn] … … 10682 10681 rvarvalst[tuple(cslice2D)] = varobj[tuple(cslicev)] 10683 10682 for iz in range(dimz): 10684 zslice = [slice(iz)]+cslice2Dhor10685 rvarvalst[iz,:,:] = np.where(circdist[tuple( cslice2Dhor)] >\10683 tslice = [slice(it)]+cslice2Dhor 10684 rvarvalst[iz,:,:] = np.where(circdist[tuple(tslice)] > \ 10686 10685 np.float(Nrad), fillValue, rvarvalst[iz,:,:]) 10687 10686 … … 10709 10708 cslicevnoT.append(slice(gtrajvals[it,1]-Nrad, gtrajvals[it,1]+ \ 10710 10709 Nrad+1)) 10711 cslicevnoThor.append(slice(gtrajvals[it,2]-Nrad, gtrajvals[it,2]+ 10710 cslicevnoThor.append(slice(gtrajvals[it,2]-Nrad, gtrajvals[it,2]+\ 10712 10711 Nrad+1)) 10713 cslicevnoThor.append(slice(gtrajvals[it,1]-Nrad, gtrajvals[it,1]+ 10712 cslicevnoThor.append(slice(gtrajvals[it,1]-Nrad, gtrajvals[it,1]+\ 10714 10713 Nrad+1)) 10715 10714 cslice2D.append(slice(0,dimz)) … … 10720 10719 10721 10720 rvarvalst = varobj[tuple(cslicev)] 10722 cdist = circdist[tuple( cslicevnoThor)]10721 cdist = circdist[tuple([it] + cslicevnoThor)] 10723 10722 # circle values 10724 10723 for iz in range(dimz): 10725 zslice = [slice(iz)]+cslicevnoThor10726 rvarvalst[iz,:,:] = np.where(circdist[tuple( cslicevnoThor)] >\10724 tslice = [slice(it)]+cslicevnoThor 10725 rvarvalst[iz,:,:] = np.where(circdist[tuple(tslice)] > \ 10727 10726 np.float(Nrad), fillValue, rvarvalst[iz,:,:]) 10728 10727 … … 10950 10949 # circle values 10951 10950 rvarvalst = np.where(cdist > np.float(Nrad),fillValue,rvarvalst) 10951 print it,'Lluis: cdist', cdist, 'Nrad:',Nrad 10952 10952 10953 10953 rvarvals[it,:,:] = rvarvalst
Note: See TracChangeset
for help on using the changeset viewer.