Changeset 2492 in lmdz_wrf
- Timestamp:
- May 1, 2019, 5:05:24 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/geometry_tools.py
r2491 r2492 44 44 # p_reg_polygon: Function to provide a regular polygon of Nv vertices 45 45 # p_reg_star: Function to provide a regular star of Nv vertices 46 # p_sinusiode: Function to get coordinates of a sinusoidal curve 46 47 # p_square: Function to get a polygon square 47 48 # p_spiral: Function to provide a polygon of an Archimedean spiral … … 620 621 621 622 return reg_star 623 624 def p_sinusiode(length=10., amp=5., lamb=3., ival=0., func='sin', N=100): 625 """ Function to get coordinates of a sinusoidal curve 626 length: length of the line (default 10.) 627 amp: amplitude of the peaks (default 5.) 628 lamb: wave longitude (defalult 3.) 629 ival: initial angle (default 0. in degree) 630 func: function to use: (default sinus) 631 'sin': sinus 632 'cos': cosinus 633 N: number of points (default 100) 634 """ 635 fname = 'p_sinusiode' 636 availfunc = ['sin', 'cos'] 637 638 dx = length/(N-1) 639 ia = ival*np.pi/180. 640 da = 2*np.pi*dx/3. 641 642 sinusoide = np.zeros((N,2), dtype=np.float) 643 if func == 'sin': 644 for ix in range(N): 645 sinusoide[ix,:] = [amp*np.sin(ia+da*ix),dx*ix] 646 elif func == 'cos': 647 for ix in range(N): 648 sinusoide[ix,:] = [amp*np.cos(ia+da*ix),dx*ix] 649 else: 650 print errormsg 651 print ' ' + fname + ": function '" + func + "' not ready !!" 652 print ' available ones:', availfunc 653 quit(-1) 654 655 656 return sinusoide 622 657 623 658 # Combined objects
Note: See TracChangeset
for help on using the changeset viewer.