Changeset 2576 in lmdz_wrf


Ignore:
Timestamp:
Jun 1, 2019, 8:12:33 PM (5 years ago)
Author:
lfita
Message:

Adding:

  • `special_buoy1': Function to draw an special mark buoy using buoy1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/geometry_tools.py

    r2572 r2576  
    7171# red_buoy1: Function to draw a red mark buoy using buoy1
    7272# safewater_buoy1: Function to draw a safe water mark buoy using buoy1
     73# special_buoy1: Function to draw an special mark buoy using buoy1
    7374# surface_sphere: Function to provide an sphere as matrix of x,y,z coordinates
    7475# z_boat: Function to define an schematic boat from the z-plane
     
    26332634    return buoy, buoysecs, buoydic
    26342635
     2636def special_buoy1(height=5., width=10., bradii=1.75, bfrac=0.8, hsigns=0.5, N=300):
     2637    """ Function to draw an special mark buoy using buoy1
     2638      height: height of the prism (5., default)
     2639      width: width of the prism (10., default)
     2640      bradii: radii of the ball (1.75, default)
     2641      bfrac: fraction of the ball above the prism (0.8, default)
     2642      hisgns: height of the signs [as reg. triangle] as percentage of the height
     2643        (0.5, default)
     2644      N: total number of points of the buoy (300, default)
     2645    """
     2646    fname = 'special_buoy1'
     2647
     2648    buoy = np.ones((N,2), dtype=np.float)*gen.fillValueF
     2649
     2650    # buoy
     2651    N2 = int(N/2)
     2652    buoy1v, buoy1vsecs, buoy1vdic = buoy1(height=5., width=10., bradii=1.75,         \
     2653      bfrac=0.8, N=N2)
     2654    buoy[0:N2,:] = buoy1v
     2655
     2656    Height = np.max(buoy1v[:,0])
     2657
     2658    # sign
     2659    N3 = N - N2 - 1
     2660   
     2661    bottsigns = 2.*bradii+height
     2662    lsign = height*hsigns
     2663    # up
     2664    cross, crosssecs, crossdic = p_cross_width(lsign, width=0.2*lsign, Narms=2, N=N3)
     2665    cross = rotate_polygon_2D(cross, 40.05)
     2666    buoy[N2+1:N,:] = cross + [Height+1.1*lsign,0.]
     2667
     2668    # painting it
     2669    buoy = ma.masked_equal(buoy, gen.fillValueF)
     2670
     2671    buoysecs = ['buoy', 'sign']
     2672    buoydic = {'buoy': [buoy[0:N2,:],'-','#FFFF00',1.5],                             \
     2673      'sign': [buoy[N2+1:N,:],'-','#FFFF00',1.5]}
     2674
     2675    return buoy, buoysecs, buoydic
     2676
    26352677####### ####### ##### #### ### ## #
    26362678# Plotting
Note: See TracChangeset for help on using the changeset viewer.