- Timestamp:
- Feb 25, 2015, 7:44:56 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r304 r305 10722 10722 rstatvarvals = np.ones(tuple([Ttraj,dimz,6]), dtype=np.float) 10723 10723 10724 for it 0in range(Ttraj):10725 it = Tbeg + it010724 for it in range(Ttraj): 10725 it0 = Tbeg + it 10726 10726 10727 10727 slicev = [] … … 10734 10734 cslicevnoThor = [] 10735 10735 10736 slicev.append(gtrajvals[it 0,0])10737 if gtrajvals[it 0,2]-box2 < 0 or gtrajvals[it0,2]+box2 + 1 > dimy + 1\10738 or gtrajvals[it 0,1]-box2 < 0 or gtrajvals[it0,1]+box2 + 1 > dimx +1:10736 slicev.append(gtrajvals[it,0]) 10737 if gtrajvals[it,2]-box2 < 0 or gtrajvals[it,2]+box2 + 1 > dimy + 1 \ 10738 or gtrajvals[it,1]-box2 < 0 or gtrajvals[it,1]+box2 + 1 > dimx +1: 10739 10739 # box values 10740 10740 slicev.append(slice(0,dimz)) 10741 slicev.append(slice(yrangeslice[it0][0],yrangeslice[it 0][1]))10742 slicev.append(slice(xrangeslice[it0][0],xrangeslice[it 0][1]))10741 slicev.append(slice(yrangeslice[it0][0],yrangeslice[it][1])) 10742 slicev.append(slice(xrangeslice[it0][0],xrangeslice[it][1])) 10743 10743 10744 10744 slicevnoT.append(slice(0,dimz)) 10745 slicevnoT.append(slice(yrangeslice[it 0][0],yrangeslice[it0][1]))10746 slicevnoT.append(slice(xrangeslice[it 0][0],xrangeslice[it0][1]))10745 slicevnoT.append(slice(yrangeslice[it][0],yrangeslice[it][1])) 10746 slicevnoT.append(slice(xrangeslice[it][0],xrangeslice[it][1])) 10747 10747 10748 10748 slice2D.append(slice(0,dimz)) 10749 slice2D.append(slice(0,yrangeslice[it 0][1]-yrangeslice[it0][0]))10750 slice2D.append(slice(0,xrangeslice[it 0][1]-xrangeslice[it0][0]))10749 slice2D.append(slice(0,yrangeslice[it][1]-yrangeslice[it][0])) 10750 slice2D.append(slice(0,xrangeslice[it][1]-xrangeslice[it][0])) 10751 10751 10752 10752 rvarvalst = np.ones((dimz, Nrad*2+1, Nrad*2+1),dtype=np.float)* \ … … 10769 10769 else: 10770 10770 slicev.append(slice(0,dimz)) 10771 slicev.append(slice(gtrajvals[it0,2]-box2, \ 10772 gtrajvals[it0,2]+box2+1)) 10773 slicev.append(slice(gtrajvals[it0,1]-box2, \ 10774 gtrajvals[it0,1]+box2+1)) 10771 slicev.append(slice(gtrajvals[it,2]-box2, gtrajvals[it,2]+box2+1)) 10772 slicev.append(slice(gtrajvals[it,1]-box2, gtrajvals[it,1]+box2+1)) 10775 10773 slicevnoT.append(slice(0,dimz)) 10776 slicevnoT.append(slice(gtrajvals[it 0,2]-box2, gtrajvals[it0,2]+\10774 slicevnoT.append(slice(gtrajvals[it,2]-box2, gtrajvals[it,2]+ \ 10777 10775 box2+1)) 10778 slicevnoT.append(slice(gtrajvals[it 0,1]-box2, gtrajvals[it0,1]+\10776 slicevnoT.append(slice(gtrajvals[it,1]-box2, gtrajvals[it,1]+ \ 10779 10777 box2+1)) 10780 10778 slice2D.append(slice(0,dimz)) 10781 slice2D.append(slice(gtrajvals[it 0,2]-box2, gtrajvals[it0,2] +\10779 slice2D.append(slice(gtrajvals[it,2]-box2, gtrajvals[it,2] + \ 10782 10780 box2 + 1)) 10783 slice2D.append(slice(gtrajvals[it 0,1]-box2, gtrajvals[it0,1] +\10781 slice2D.append(slice(gtrajvals[it,1]-box2, gtrajvals[it,1] + \ 10784 10782 box2 + 1)) 10785 10783 … … 10803 10801 10804 10802 # Circle values 10805 cslicev.append(gtrajvals[it 0,0])10806 if gtrajvals[it 0,2]-Nrad < 0 or gtrajvals[it0,2]+Nrad + 1 > dimy + 1\10807 or gtrajvals[it 0,1]-Nrad < 0 or gtrajvals[it0,1]+Nrad + 1 > dimx +1:10803 cslicev.append(gtrajvals[it,0]) 10804 if gtrajvals[it,2]-Nrad < 0 or gtrajvals[it,2]+Nrad + 1 > dimy + 1 \ 10805 or gtrajvals[it,1]-Nrad < 0 or gtrajvals[it,1]+Nrad + 1 > dimx + 1: 10808 10806 cslicev.append(slice(0,dimz)) 10809 cslicev.append(slice(cyrangeslice[it 0][0],cyrangeslice[it0][1]))10810 cslicev.append(slice(cxrangeslice[it 0][0],cxrangeslice[it0][1]))10807 cslicev.append(slice(cyrangeslice[it][0],cyrangeslice[it][1])) 10808 cslicev.append(slice(cxrangeslice[it][0],cxrangeslice[it][1])) 10811 10809 10812 10810 cslicevnoT.append(slice(0,dimz)) 10813 cslicevnoT.append(slice(cyrangeslice[it0][0], \ 10814 cyrangeslice[it0][1])) 10815 cslicevnoT.append(slice(cxrangeslice[it0][0], \ 10816 cxrangeslice[it0][1])) 10811 cslicevnoT.append(slice(cyrangeslice[it][0], cyrangeslice[it][1])) 10812 cslicevnoT.append(slice(cxrangeslice[it][0], cxrangeslice[it][1])) 10817 10813 10818 10814 cslice2D.append(slice(0,dimz)) 10819 cslice2D.append(slice(0,cyrangeslice[it0][1]- \ 10820 cyrangeslice[it0][0])) 10821 cslice2D.append(slice(0,cxrangeslice[it0][1]- \ 10822 cxrangeslice[it0][0])) 10823 cslice2Dhor.append(slice(0, cyrangeslice[it0][1] - \ 10824 cyrangeslice[it0][0])) 10825 cslice2Dhor.append(slice(0, cxrangeslice[it0][1] - \ 10826 cxrangeslice[it0][0])) 10815 cslice2D.append(slice(0,cyrangeslice[it][1]-cyrangeslice[it][0])) 10816 cslice2D.append(slice(0,cxrangeslice[it][1]-cxrangeslice[it][0])) 10817 cslice2Dhor.append(slice(0, cyrangeslice[it][1] - \ 10818 cyrangeslice[it][0])) 10819 cslice2Dhor.append(slice(0, cxrangeslice[it][1] - \ 10820 cxrangeslice[it][0])) 10827 10821 10828 10822 rvarvalst = np.ones((dimz,Nrad*2+1,Nrad*2+1),dtype=np.float)* \ … … 10830 10824 rvarvalst[tuple(cslice2D)] = varobj[tuple(cslicev)] 10831 10825 for iz in range(dimz): 10832 tslice = [slice(it 0)]+cslice2Dhor10826 tslice = [slice(it)]+cslice2Dhor 10833 10827 rvarvalst[iz,:,:] = np.where(circdist[tuple(tslice)] > \ 10834 10828 np.float(Nrad), fillValue, rvarvalst[iz,:,:]) … … 10850 10844 else: 10851 10845 cslicev.append(slice(0,dimz)) 10852 cslicev.append(slice(gtrajvals[it0,2]-Nrad,gtrajvals[it0,2]+Nrad+\ 10853 1)) 10854 cslicev.append(slice(gtrajvals[it0,1]-Nrad,gtrajvals[it0,1]+Nrad+\ 10855 1)) 10846 cslicev.append(slice(gtrajvals[it,2]-Nrad,gtrajvals[it,2]+Nrad+1)) 10847 cslicev.append(slice(gtrajvals[it,1]-Nrad,gtrajvals[it,1]+Nrad+1)) 10856 10848 cslicevnoT.append(slice(0,dimz)) 10857 cslicevnoT.append(slice(gtrajvals[it 0,2]-Nrad, gtrajvals[it0,2]+\10849 cslicevnoT.append(slice(gtrajvals[it,2]-Nrad, gtrajvals[it,2]+ \ 10858 10850 Nrad+1)) 10859 cslicevnoT.append(slice(gtrajvals[it 0,1]-Nrad, gtrajvals[it0,1]+\10851 cslicevnoT.append(slice(gtrajvals[it,1]-Nrad, gtrajvals[it,1]+ \ 10860 10852 Nrad+1)) 10861 cslicevnoThor.append(slice(gtrajvals[it 0,2]-Nrad,\10862 gtrajvals[it 0,2] + Nrad+1))10863 cslicevnoThor.append(slice(gtrajvals[it 0,1]-Nrad,\10864 gtrajvals[it 0,1] + Nrad+1))10853 cslicevnoThor.append(slice(gtrajvals[it,2]-Nrad, \ 10854 gtrajvals[it,2] + Nrad+1)) 10855 cslicevnoThor.append(slice(gtrajvals[it,1]-Nrad, \ 10856 gtrajvals[it,1] + Nrad+1)) 10865 10857 cslice2D.append(slice(0,dimz)) 10866 cslice2D.append(slice(gtrajvals[it 0,2]-Nrad,gtrajvals[it0,2] +\10858 cslice2D.append(slice(gtrajvals[it,2]-Nrad,gtrajvals[it,2] + \ 10867 10859 Nrad+1)) 10868 cslice2D.append(slice(gtrajvals[it 0,1]-Nrad,gtrajvals[it0,1] +\10860 cslice2D.append(slice(gtrajvals[it,1]-Nrad,gtrajvals[it,1] + \ 10869 10861 Nrad+1)) 10870 10862 … … 10872 10864 # circle values 10873 10865 for iz in range(dimz): 10874 tslice = [it 0]+cslicevnoThor10866 tslice = [it]+cslicevnoThor 10875 10867 rvarvalst[iz,:,:] = np.where(circdist[tuple(tslice)] > \ 10876 10868 np.float(Nrad), fillValue, rvarvalst[iz,:,:]) … … 10975 10967 rstatvarvals = np.ones(tuple([Ttraj,6]), dtype=np.float) 10976 10968 10977 for it 0in range(Ttraj):10978 it = Tbeg + it010969 for it in range(Ttraj): 10970 it0 = Tbeg + it 10979 10971 10980 10972 slicev = []
Note: See TracChangeset
for help on using the changeset viewer.