Changeset 2578 in lmdz_wrf for trunk/tools/geometry_tools.py
- Timestamp:
- Jun 1, 2019, 9:03:10 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/geometry_tools.py
r2577 r2578 813 813 if eep == N: eep = 0 814 814 815 if polygon[ip,1] <= xval and polygon[eep,1] >= xval: 815 if (polygon[ip,1] <= xval and polygon[eep,1] > xval) or \ 816 (polygon[ip,1] < xval and polygon[eep,1] >= xval): 816 817 icut[ic] = ip 817 818 dx[ic] = polygon[eep,1] - polygon[ip,1] … … 820 821 ipt[ic,:] = [polygon[ip,0]+dy[ic]*dd/dx[ic], xval] 821 822 822 if polygon[ip,1] >= yval and polygon[eep,1] <= xval: 823 if (polygon[ip,1] >= yval and polygon[eep,1] < xval) or \ 824 (polygon[ip,1] > yval and polygon[eep,1] <= xval): 823 825 ecut[ic] = ip 824 826 dx[ic] = polygon[eep,1] - polygon[ip,1] … … 832 834 if eep == N: eep = 0 833 835 834 if polygon[ip,1] <= xval and polygon[eep,1] >= xval: 836 if (polygon[ip,1] <= xval and polygon[eep,1] > xval) or \ 837 (polygon[ip,1] < xval and polygon[eep,1] >= xval): 835 838 icut[ic] = ip 836 839 dx[ic] = polygon[eep,1] - polygon[ip,1] … … 841 844 ipt[ic,:] = [polygon[ip,0]+dy[ic]*dd/dx[ic], xval] 842 845 843 if polygon[ip,1] >= xval and polygon[eep,1] <= xval: 846 if (polygon[ip,1] >= xval and polygon[eep,1] < xval) or \ 847 (polygon[ip,1] > xval and polygon[eep,1] <= xval): 844 848 ecut[ic] = ip 845 849 dx[ic] = polygon[eep,1] - polygon[ip,1] 846 850 dy[ic] = polygon[eep,0] - polygon[ip,0] 847 851 dd = xval - polygon[ip,1] 848 ept[ic,:] = [polygon[ip,0]+dy[ic]*dd/dx[ic], xval] 852 if dx[ic] == 0.: 853 ept[ic,:] = [polygon[eep,0], xval] 854 else: 855 ept[ic,:] = [polygon[ip,0]+dy[ic]*dd/dx[ic], xval] 849 856 850 857 if ipt is None or ept is None: … … 2668 2675 lsign = height*hsigns 2669 2676 # up 2670 cross, crosssecs, crossdic = p_cross_width(lsign, width=0. 2*lsign, Narms=2, N=N3)2677 cross, crosssecs, crossdic = p_cross_width(lsign, width=0.3*lsign, Narms=2, N=N3) 2671 2678 cross = rotate_polygon_2D(cross, 40.05) 2672 2679 buoy[N2+1:N,:] = cross + [Height+1.1*lsign,0.] … … 2709 2716 lsign = height*hsigns 2710 2717 # up 2711 cross, crosssecs, crossdic = p_cross_width(lsign, width=0. 2*lsign, Narms=2, N=N3)2718 cross, crosssecs, crossdic = p_cross_width(lsign, width=0.3*lsign, Narms=2, N=N3) 2712 2719 buoy[N2+1:N,:] = cross + [Height+1.1*lsign,0.] 2713 2720 2714 2721 # painting it 2715 Ncut, quart1 = cut_xpolygon(buoy1v, xval=width/4., keep='left') 2716 Ncut, quart2 = cut_between_xpolygon(buoy1v, xval1=width/4., xval2=width/2) 2717 Ncut, quart3 = cut_between_xpolygon(buoy1v, xval1=width/2., xval2=width*3./4.) 2718 Ncut, quart4 = cut_xpolygon(buoy1v, xval=width*3./4., keep='right') 2722 ix = -width/2. 2723 Ncut, fifth1 = cut_xpolygon(buoy1v, xval=ix+width/5., keep='left') 2724 Ncut, fifth2 = cut_between_xpolygon(buoy1v,xval1=ix+width/5.,xval2=ix+width*2./5.) 2725 Ncut, fifth3 = cut_between_xpolygon(buoy1v,xval1=ix+width*2./5.,xval2=ix+width*3./5.) 2726 Ncut, fifth4 = cut_between_xpolygon(buoy1v,xval1=ix+width*3./5.,xval2=ix+width*4./5.) 2727 Ncut, fifth5 = cut_xpolygon(buoy1v, xval=ix+width*4./5., keep='right') 2719 2728 2720 2729 buoy = ma.masked_equal(buoy, gen.fillValueF) 2721 2730 2722 buoysecs = ['buoy', 'sign' ]2731 buoysecs = ['buoy', 'sign', 'fifth1', 'fifth2', 'fifth3', 'fifth4', 'fifth5'] 2723 2732 buoydic = {'buoy': [buoy[0:N2,:],'-','#FFFF00',1.5], \ 2724 'sign': [buoy[N2+1:N,:],'-','#FFFF00',1.5],' quart1':[quart1,'-','#0000FF',1.5],\2725 ' quart2': [quart2,'-','#FFFF00',1.5],'quart3': [quart3,'-','#0000FF',1.5], \2726 ' quart4': [quart4,'-','#FFFF00',1.5]}2733 'sign': [buoy[N2+1:N,:],'-','#FFFF00',1.5],'fifth1':[fifth1,'-','#FFFF00',1.5],\ 2734 'fifth2': [fifth2,'-','#FFFF00',1.5],'fifth3': [fifth3,'-','#0000FF',1.5], \ 2735 'fifth4': [fifth4,'-','#FFFF00',1.5],'fifth5': [fifth5,'-','#0000FF',1.5]} 2727 2736 2728 2737 return buoy, buoysecs, buoydic
Note: See TracChangeset
for help on using the changeset viewer.