Changeset 289 in lmdz_wrf
- Timestamp:
- Feb 25, 2015, 4:04:12 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r288 r289 10591 10591 cslicevnoThor = [] 10592 10592 10593 slicev.append(gtrajvals[it ,0])10594 if gtrajvals[it ,2]-box2 < 0 or gtrajvals[it,2]+box2 + 1 > dimy + 1\10595 or gtrajvals[it ,1]-box2 < 0 or gtrajvals[it,1]+box2 + 1 > dimx +1:10593 slicev.append(gtrajvals[it0,0]) 10594 if gtrajvals[it0,2]-box2 < 0 or gtrajvals[it0,2]+box2 + 1 > dimy + 1 \ 10595 or gtrajvals[it0,1]-box2 < 0 or gtrajvals[it0,1]+box2 + 1 > dimx +1: 10596 10596 # box values 10597 10597 slicev.append(slice(0,dimz)) 10598 slicev.append(slice(yrangeslice[it ][0],yrangeslice[it][1]))10599 slicev.append(slice(xrangeslice[it ][0],xrangeslice[it][1]))10598 slicev.append(slice(yrangeslice[it0][0],yrangeslice[it0][1])) 10599 slicev.append(slice(xrangeslice[it0][0],xrangeslice[it0][1])) 10600 10600 10601 10601 slicevnoT.append(slice(0,dimz)) 10602 slicevnoT.append(slice(yrangeslice[it ][0],yrangeslice[it][1]))10603 slicevnoT.append(slice(xrangeslice[it ][0],xrangeslice[it][1]))10602 slicevnoT.append(slice(yrangeslice[it0][0],yrangeslice[it0][1])) 10603 slicevnoT.append(slice(xrangeslice[it0][0],xrangeslice[it0][1])) 10604 10604 10605 10605 slice2D.append(slice(0,dimz)) 10606 slice2D.append(slice(0,yrangeslice[it ][1]-yrangeslice[it][0]))10607 slice2D.append(slice(0,xrangeslice[it ][1]-xrangeslice[it][0]))10606 slice2D.append(slice(0,yrangeslice[it0][1]-yrangeslice[it0][0])) 10607 slice2D.append(slice(0,xrangeslice[it0][1]-xrangeslice[it0][0])) 10608 10608 10609 10609 rvarvalst = np.ones((dimz, Nrad*2+1, Nrad*2+1),dtype=np.float)* \ … … 10626 10626 else: 10627 10627 slicev.append(slice(0,dimz)) 10628 slicev.append(slice(gtrajvals[it,2]-box2, gtrajvals[it,2]+box2+1)) 10629 slicev.append(slice(gtrajvals[it,1]-box2, gtrajvals[it,1]+box2+1)) 10628 slicev.append(slice(gtrajvals[it0,2]-box2, \ 10629 gtrajvals[it0,2]+box2+1)) 10630 slicev.append(slice(gtrajvals[it0,1]-box2, \ 10631 gtrajvals[it0,1]+box2+1)) 10630 10632 slicevnoT.append(slice(0,dimz)) 10631 slicevnoT.append(slice(gtrajvals[it ,2]-box2, gtrajvals[it,2]+\10633 slicevnoT.append(slice(gtrajvals[it0,2]-box2, gtrajvals[it0,2]+ \ 10632 10634 box2+1)) 10633 slicevnoT.append(slice(gtrajvals[it ,1]-box2, gtrajvals[it,1]+\10635 slicevnoT.append(slice(gtrajvals[it0,1]-box2, gtrajvals[it0,1]+ \ 10634 10636 box2+1)) 10635 10637 slice2D.append(slice(0,dimz)) 10636 slice2D.append(slice(gtrajvals[it ,2]-box2, gtrajvals[it,2]+box2 +\10637 1))10638 slice2D.append(slice(gtrajvals[it ,1]-box2, gtrajvals[it,1]+box2 +\10639 1))10638 slice2D.append(slice(gtrajvals[it0,2]-box2, gtrajvals[it0,2] + \ 10639 box2 + 1)) 10640 slice2D.append(slice(gtrajvals[it0,1]-box2, gtrajvals[it0,1] + \ 10641 box2 + 1)) 10640 10642 10641 10643 varvalst = varobj[tuple(slicev)] … … 10658 10660 10659 10661 # Circle values 10660 cslicev.append(gtrajvals[it ,0])10661 if gtrajvals[it ,2]-Nrad < 0 or gtrajvals[it,2]+Nrad + 1 > dimy + 1\10662 or gtrajvals[it ,1]-Nrad < 0 or gtrajvals[it,1]+Nrad + 1 > dimx +1:10662 cslicev.append(gtrajvals[it0,0]) 10663 if gtrajvals[it0,2]-Nrad < 0 or gtrajvals[it0,2]+Nrad + 1 > dimy + 1 \ 10664 or gtrajvals[it0,1]-Nrad < 0 or gtrajvals[it0,1]+Nrad + 1 > dimx +1: 10663 10665 cslicev.append(slice(0,dimz)) 10664 cslicev.append(slice(cyrangeslice[it ][0],cyrangeslice[it][1]))10665 cslicev.append(slice(cxrangeslice[it ][0],cxrangeslice[it][1]))10666 cslicev.append(slice(cyrangeslice[it0][0],cyrangeslice[it0][1])) 10667 cslicev.append(slice(cxrangeslice[it0][0],cxrangeslice[it0][1])) 10666 10668 10667 10669 cslicevnoT.append(slice(0,dimz)) 10668 cslicevnoT.append(slice(cyrangeslice[it][0],cyrangeslice[it][1])) 10669 cslicevnoT.append(slice(cxrangeslice[it][0],cxrangeslice[it][1])) 10670 cslicevnoT.append(slice(cyrangeslice[it0][0], \ 10671 cyrangeslice[it0][1])) 10672 cslicevnoT.append(slice(cxrangeslice[it0][0], \ 10673 cxrangeslice[it0][1])) 10670 10674 10671 10675 cslice2D.append(slice(0,dimz)) 10672 cslice2D.append(slice(0,cyrangeslice[it][1]-cyrangeslice[it][0])) 10673 cslice2D.append(slice(0,cxrangeslice[it][1]-cxrangeslice[it][0])) 10674 cslice2Dhor.append(slice(0, cyrangeslice[it][1] - \ 10675 cyrangeslice[it][0])) 10676 cslice2Dhor.append(slice(0, cxrangeslice[it][1] - \ 10677 cxrangeslice[it][0])) 10676 cslice2D.append(slice(0,cyrangeslice[it0][1]- \ 10677 cyrangeslice[it0][0])) 10678 cslice2D.append(slice(0,cxrangeslice[it0][1]- \ 10679 cxrangeslice[it0][0])) 10680 cslice2Dhor.append(slice(0, cyrangeslice[it0][1] - \ 10681 cyrangeslice[it0][0])) 10682 cslice2Dhor.append(slice(0, cxrangeslice[it0][1] - \ 10683 cxrangeslice[it0][0])) 10678 10684 10679 10685 rvarvalst = np.ones((dimz,Nrad*2+1,Nrad*2+1),dtype=np.float)* \ … … 10681 10687 rvarvalst[tuple(cslice2D)] = varobj[tuple(cslicev)] 10682 10688 for iz in range(dimz): 10683 tslice = [slice(it )]+cslice2Dhor10689 tslice = [slice(it0)]+cslice2Dhor 10684 10690 rvarvalst[iz,:,:] = np.where(circdist[tuple(tslice)] > \ 10685 10691 np.float(Nrad), fillValue, rvarvalst[iz,:,:]) … … 10701 10707 else: 10702 10708 cslicev.append(slice(0,dimz)) 10703 cslicev.append(slice(gtrajvals[it,2]-Nrad,gtrajvals[it,2]+Nrad+1)) 10704 cslicev.append(slice(gtrajvals[it,1]-Nrad,gtrajvals[it,1]+Nrad+1)) 10709 cslicev.append(slice(gtrajvals[it0,2]-Nrad,gtrajvals[it0,2]+Nrad+\ 10710 1)) 10711 cslicev.append(slice(gtrajvals[it0,1]-Nrad,gtrajvals[it0,1]+Nrad+\ 10712 1)) 10705 10713 cslicevnoT.append(slice(0,dimz)) 10706 cslicevnoT.append(slice(gtrajvals[it ,2]-Nrad, gtrajvals[it,2]+\10714 cslicevnoT.append(slice(gtrajvals[it0,2]-Nrad, gtrajvals[it0,2]+ \ 10707 10715 Nrad+1)) 10708 cslicevnoT.append(slice(gtrajvals[it ,1]-Nrad, gtrajvals[it,1]+\10716 cslicevnoT.append(slice(gtrajvals[it0,1]-Nrad, gtrajvals[it0,1]+ \ 10709 10717 Nrad+1)) 10710 cslicevnoThor.append(slice(gtrajvals[it,2]-Nrad, gtrajvals[it,2]+\ 10718 cslicevnoThor.append(slice(gtrajvals[it0,2]-Nrad, \ 10719 gtrajvals[it0,2] + Nrad+1)) 10720 cslicevnoThor.append(slice(gtrajvals[it0,1]-Nrad, \ 10721 gtrajvals[it0,1] + Nrad+1)) 10722 cslice2D.append(slice(0,dimz)) 10723 cslice2D.append(slice(gtrajvals[it0,2]-Nrad,gtrajvals[it0,2] + \ 10711 10724 Nrad+1)) 10712 cslice vnoThor.append(slice(gtrajvals[it,1]-Nrad, gtrajvals[it,1]+\10725 cslice2D.append(slice(gtrajvals[it0,1]-Nrad,gtrajvals[it0,1] + \ 10713 10726 Nrad+1)) 10714 cslice2D.append(slice(0,dimz))10715 cslice2D.append(slice(gtrajvals[it,2]-Nrad,gtrajvals[it,2]+Nrad+ \10716 1))10717 cslice2D.append(slice(gtrajvals[it,1]-Nrad,gtrajvals[it,1]+Nrad+ \10718 1))10719 10727 10720 10728 rvarvalst = varobj[tuple(cslicev)] … … 10722 10730 # circle values 10723 10731 for iz in range(dimz): 10724 tslice = [it ]+cslicevnoThor10732 tslice = [it0]+cslicevnoThor 10725 10733 rvarvalst[iz,:,:] = np.where(circdist[tuple(tslice)] > \ 10726 10734 np.float(Nrad), fillValue, rvarvalst[iz,:,:])
Note: See TracChangeset
for help on using the changeset viewer.