Changeset 284 in lmdz_wrf
- Timestamp:
- Feb 25, 2015, 2:48:15 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r283 r284 10564 10564 or gtrajvals[it,1]-box2 < 0 or gtrajvals[it,1]+box2 + 1 > dimx + 1: 10565 10565 # box values 10566 slicev.append(slice(0,dimz) 10566 slicev.append(slice(0,dimz)) 10567 10567 slicev.append(slice(yrangeslice[it][0],yrangeslice[it][1])) 10568 10568 slicev.append(slice(xrangeslice[it][0],xrangeslice[it][1])) 10569 10569 10570 slicevnoT.append(slice(0,dimz) 10570 slicevnoT.append(slice(0,dimz)) 10571 10571 slicevnoT.append(slice(yrangeslice[it][0],yrangeslice[it][1])) 10572 10572 slicevnoT.append(slice(xrangeslice[it][0],xrangeslice[it][1])) 10573 10573 10574 slice2D.append(slice(0,dimz) 10574 slice2D.append(slice(0,dimz)) 10575 10575 slice2D.append(slice(0,yrangeslice[it][1]-yrangeslice[it][0])) 10576 10576 slice2D.append(slice(0,xrangeslice[it][1]-xrangeslice[it][0])) … … 10594 10594 10595 10595 else: 10596 slicev.append(slice(0,dimz) 10596 slicev.append(slice(0,dimz)) 10597 10597 slicev.append(slice(gtrajvals[it,2]-box2, gtrajvals[it,2]+box2+1)) 10598 10598 slicev.append(slice(gtrajvals[it,1]-box2, gtrajvals[it,1]+box2+1)) 10599 slicevnoT.append(slice(0,dimz) 10599 slicevnoT.append(slice(0,dimz)) 10600 10600 slicevnoT.append(slice(gtrajvals[it,2]-box2, gtrajvals[it,2]+ \ 10601 10601 box2+1)) 10602 10602 slicevnoT.append(slice(gtrajvals[it,1]-box2, gtrajvals[it,1]+ \ 10603 10603 box2+1)) 10604 slice2D.append(slice(0,dimz) 10604 slice2D.append(slice(0,dimz)) 10605 10605 slice2D.append(slice(gtrajvals[it,2]-box2, gtrajvals[it,2]+box2 +\ 10606 10606 1)) … … 10616 10616 10617 10617 # box stats values 10618 statvarvals[it,:,0] = varvalst[box2,box2] 10619 statvarvals[it,:,1] = np.min(varvalst) 10620 statvarvals[it,:,2] = np.max(varvalst) 10621 statvarvals[it,:,3] = np.mean(varvalst) 10622 statvarvals[it,:,4] = np.mean(varvalst*varvalst) 10623 statvarvals[it,:,5] = np.sqrt(statvarvals[it,:,4] - \ 10624 statvarvals[it,:,3]*statvarvals[it,:,3]) 10618 statvarvals[it,:,0] = varvalst[:,box2,box2] 10619 for iz in range(dimz): 10620 statvarvals[it,iz,1] = np.min(varvalst[iz,:,:]) 10621 statvarvals[it,iz,2] = np.max(varvalst[iz,:,:]) 10622 statvarvals[it,iz,3] = np.mean(varvalst[iz,:,:]) 10623 statvarvals[it,iz,4] = np.mean(varvalst*varvalst[iz,:,:]) 10624 statvarvals[it,iz,5] = np.sqrt(statvarvals[it,iz,4] - \ 10625 statvarvals[it,iz,3]*statvarvals[it,iz,3]) 10625 10626 10626 10627 # Circle values … … 10628 10629 if gtrajvals[it,2]-Nrad < 0 or gtrajvals[it,2]+Nrad + 1 > dimy + 1 \ 10629 10630 or gtrajvals[it,1]-Nrad < 0 or gtrajvals[it,1]+Nrad + 1 > dimx + 1: 10630 cslicev.append(slice(0,dimz) 10631 cslicev.append(slice(0,dimz)) 10631 10632 cslicev.append(slice(cyrangeslice[it][0],cyrangeslice[it][1])) 10632 10633 cslicev.append(slice(cxrangeslice[it][0],cxrangeslice[it][1])) 10633 10634 10634 cslicevnoT.append(slice(0,dimz) 10635 cslicevnoT.append(slice(0,dimz)) 10635 10636 cslicevnoT.append(slice(cyrangeslice[it][0],cyrangeslice[it][1])) 10636 10637 cslicevnoT.append(slice(cxrangeslice[it][0],cxrangeslice[it][1])) 10637 10638 10638 cslice2D.append(slice(0,dimz) 10639 cslice2D.append(slice(0,dimz)) 10639 10640 cslice2D.append(slice(0,cyrangeslice[it][1]-cyrangeslice[it][0])) 10640 10641 cslice2D.append(slice(0,cxrangeslice[it][1]-cxrangeslice[it][0])) … … 10650 10651 # circle stats values 10651 10652 maskedvals = ma.masked_values (rvarvalst, fillValue) 10652 rstatvarvals[it,:,0] = rvarvalst[Nrad,Nrad]10653 rstatvarvals[it,:,1] = maskedvals.min()10654 rstatvarvals[it,:,2] = maskedvals.max()10655 rstatvarvals[it,:,3] = maskedvals.mean()10656 10653 maskedvals2 = maskedvals*maskedvals 10657 rstatvarvals[it,:,4] = maskedvals2.mean() 10658 rstatvarvals[it,:,5] = np.sqrt(rstatvarvals[it,:,4] - \ 10659 rstatvarvals[it,:,3]*rstatvarvals[it,:,3]) 10654 rtatvarvals[it,:,0] = varvalst[:,box2,box2] 10655 for iz in range(dimz): 10656 rtatvarvals[it,iz,1] = np.min(varvalst[iz,:,:]) 10657 rtatvarvals[it,iz,2] = np.max(varvalst[iz,:,:]) 10658 rtatvarvals[it,iz,3] = np.mean(varvalst[iz,:,:]) 10659 rtatvarvals[it,iz,4] = maskedvals2[iz,:,:].mean() 10660 rtatvarvals[it,iz,5] = np.sqrt(rstatvarvals[it,iz,4] - \ 10661 rstatvarvals[it,iz,3]*rstatvarvals[it,iz,3]) 10660 10662 10661 10663 else:
Note: See TracChangeset
for help on using the changeset viewer.