Changeset 2494 in lmdz_wrf
- Timestamp:
- May 1, 2019, 11:46:47 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/geometry_tools.py
r2493 r2494 40 40 ## Shapes/objects 41 41 # circ_sec: Function union of point A and B by a section of a circle 42 # p_doubleArrow: Function to provide an arrow with double lines 42 43 # ellipse_polar: Function to determine an ellipse from its center and polar coordinates 43 44 # p_circle: Function to get a polygon of a circle … … 653 654 quit(-1) 654 655 655 656 return sinusoide 656 sinusoidesecs = ['sinusoide'] 657 sinusoidedic = {'sinusoide': [sinusoide, '-', '#000000', 1.]} 658 659 return sinusoide, sinusoidesecs, sinusoidedic 660 661 def p_doubleArrow(length=5., angle=45., width=1., alength=0.10, N=50): 662 """ Function to provide an arrow with double lines 663 length: length of the arrow (5. default) 664 angle: angle of the head of the arrow (45., default) 665 width: separation between the two lines (2., default) 666 alength: length of the head (as percentage in excess of width, 0.1 default) 667 N: number of points (50, default) 668 """ 669 import numpy.ma as ma 670 function = 'p_doubleArrow' 671 672 doubleArrow = np.zeros((50,2), dtype=np.float) 673 N4 = int((N-3)/4) 674 675 doublearrowdic = {} 676 677 # Arms 678 dx = length/(N4-1) 679 for ix in range(N4-1): 680 doubleArrow[ix,:] = [dx*ix,-width/2.] 681 doublearrowdic['leftarm'] = [doubleArrow[0:N4-1,:], '-', '#000000', 2.] 682 doubleArrow[N4-1,:] = [gen.fillValueF,gen.fillValueF] 683 for ix in range(N4-1): 684 doubleArrow[N4+ix,:] = [dx*ix,width/2.] 685 doublearrowdic['rightarm'] = [doubleArrow[N4:2*N4-1,:], '-', '#000000', 2.] 686 doubleArrow[2*N4-1,:] = [gen.fillValueF,gen.fillValueF] 687 688 # Head 689 N42 = int((N-2 - 2*N4)/2) 690 dx = width*(1.+alength)/(N42-1) 691 for ix in range(N42): 692 doubleArrow[2*N4+ix,:] = [length-dx*ix,-dx*ix] 693 doublearrowdic['lefthead'] = [doubleArrow[2*N4:2*N4+N42,:], '-', '#000000', 2.] 694 doubleArrow[2*N4+N42,:] = [gen.fillValueF,gen.fillValueF] 695 696 N43 = N-2 - 2*N4 - N42 + 1 697 dx = width*(1.+alength)/(N43-1) 698 for ix in range(N43): 699 doubleArrow[2*N4+N42+1+ix,:] = [length-dx*ix,dx*ix] 700 doublearrowdic['rightthead'] = [doubleArrow[2*N4+N42:51,:], '-', '#000000', 2.] 701 702 doubleArrow = ma.masked_equal(doubleArrow, gen.fillValueF) 703 doublearrowsecs = ['leftarm', 'rightarm', 'lefthead', 'righthead'] 704 705 return doubleArrow, doublearrowsecs, doublearrowdic 657 706 658 707 # Combined objects
Note: See TracChangeset
for help on using the changeset viewer.