Changeset 2610 in lmdz_wrf
- Timestamp:
- Jun 18, 2019, 1:20:28 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/geometry_tools.py
r2609 r2610 848 848 else: 849 849 ##print ' ' + fname + ': found ', Ncuts, ' Ncuts' 850 if Ncuts > 1 and keep == 'left':850 if Ncuts >= 1 and keep == 'left': 851 851 # Re-shifting cuts by closest heigth. 852 852 yis = [] … … 885 885 icut.append(newecut[icc]) 886 886 ipt.append(newept[icc]) 887 ##print ' xval=', xval, 'cut, ip; ipt ep; ept ________'888 ##for ic in range(Ncuts):889 ##print ' ', ic, icut[ic], ';', ipt[ic], ecut[ic], ';', ept[ic]887 print ' xval=', xval, 'cut, ip; ipt ep; ept ________' 888 for ic in range(Ncuts): 889 print ' ', ic, icut[ic], ';', ipt[ic], ecut[ic], ';', ept[ic] 890 890 891 891 # Length of joining lines … … 924 924 925 925 cutpolygon = [] 926 927 926 iipc = 0 928 927 for ic in range(Ncuts): 929 928 dcpt = Ncpts[ic] 929 cutpolygon.append(ipt[ic]) 930 930 if keep == 'left': 931 931 if ic == 0: 932 add_secpolygon_list(cutpolygon,0,icut[ic],polygon) 932 add_secpolygon_list(cutpolygon,icut[ic]+1,N,polygon) 933 add_secpolygon_list(cutpolygon,0,ecut[ic],polygon) 933 934 iipc = icut[ic] 934 935 else: 935 936 add_secpolygon_list(cutpolygon,icut[ic]+1,ecut[ic],polygon) 936 #cutpolygon[iipc:iipc+dcpt-1,:] = polygon[icut[ic]+1:ecut[ic],:]937 iipc = iipc + dcpt -1938 937 else: 939 cutpolygon.append(ipt[ic])940 938 add_secpolygon_list(cutpolygon,icut[ic]+1,ecut[ic],polygon) 941 #cutpolygon[iipc:iipc+dcpt-1,:]=polygon[icut[ic]+1:ecut[ic],:]942 939 iipc = iipc+dcpt-1 943 944 940 # cutting line 945 941 cutline = np.zeros((Nadds[ic],2), dtype=np.float) … … 950 946 cutline[ip,:] = ipt[ic] + np.array([dy*ip,dx*ip]) 951 947 cutline[Nadds[ic]-1,:] = ept[ic] 952 print 'Lluis ipt0', ipt[ic], 'cutline[Nadds-ic,:]', cutline[Nadds[ic]-1,:], 'ept', ept[ic]953 948 if keep == 'left': 954 if ic == 0: 955 for ip in range(Nadds[ic]): cutpolygon.append(cutline[ip,:]) 956 else: 957 for ip in range(Nadds[ic]-1,0,-1): cutpolygon.append(cutline[ip,:]) 949 for ip in range(Nadds[ic]-1,-1,-1): cutpolygon.append(cutline[ip,:]) 958 950 iipc = iipc+Nadds[ic] 959 951 if ic == 0: 960 # cutpolygon[iipc:iipc+N-ecut[ic]-1,:] = polygon[ecut[ic]+1:N,:] 961 # iipc = iipc + N-ecut[ic]-1 962 add_secpolygon_list(cutpolygon,ecut[ic]-2,N,polygon) 963 #cutpolygon[iipc:iipc+N-ecut[ic]+2,:] = polygon[ecut[ic]-2:N,:] 964 iipc = iipc + N-ecut[ic]+2 952 add_secpolygon_list(cutpolygon,ecut[ic],N,polygon) 965 953 cutpolygon.append(polygon[0,:]) 966 954 iipc = iipc + 1 967 955 else: 968 for ip in range(Nadds[ic]-1, 0,-1): cutpolygon.append(cutline[ip,:])956 for ip in range(Nadds[ic]-1,-1,-1): cutpolygon.append(cutline[ip,:]) 969 957 iipc = iipc+Nadds[ic] 970 958 cutpolygon.append([gen.fillValueF, gen.fillValueF]) … … 986 974 else: 987 975 rmpolygon.append(cutpolygon[ip,:]) 988 Npts = len(rmpolygon)989 976 990 977 rmpolygon = np.array(rmpolygon) 991 978 cutpolygon = rm_consecpt_polygon(rmpolygon) 979 Npts = cutpolygon.shape[0] 992 980 993 981 cutpolygon = ma.masked_equal(cutpolygon, gen.fillValueF)
Note: See TracChangeset
for help on using the changeset viewer.