Changeset 2566 in lmdz_wrf


Ignore:
Timestamp:
May 29, 2019, 10:24:48 PM (6 years ago)
Author:
lfita
Message:

Adding:

  • `red_buoy1': Function to draw a red mark buoy using buoy1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/geometry_tools.py

    r2565 r2566  
    6161# p_triangle: Function to provide the polygon of a triangle from its 3 vertices
    6262# band_lighthouse: Function to plot a lighthouse with spiral bands
     63# red_buoy1: Function to draw a red mark buoy using buoy1
    6364# safewater_buoy1: Function to draw a safe water mark buoy using buoy1
    6465# surface_sphere: Function to provide an sphere as matrix of x,y,z coordinates
     
    21162117    return buoy, buoysecs, buoydic
    21172118
     2119def red_buoy1(height=5., width=10., bradii=1.75, bfrac=0.8, hsigns=0.3, N=300):
     2120    """ Function to draw a red mark buoy using buoy1
     2121      height: height of the prism (5., default)
     2122      width: width of the prism (10., default)
     2123      bradii: radii of the ball (1.75, default)
     2124      bfrac: fraction of the ball above the prism (0.8, default)
     2125      hisgns: height of the signs [as reg. triangle] as percentage of the height
     2126        (0.3, default)
     2127      N: total number of points of the buoy (300, default)
     2128    """
     2129    fname = 'red_buoy1'
     2130
     2131    buoy = np.ones((N,2), dtype=np.float)*gen.fillValueF
     2132
     2133    # buoy
     2134    N2 = int(N/2)
     2135    buoy1v, buoy1vsecs, buoy1vdic = buoy1(height=5., width=10., bradii=1.75,         \
     2136      bfrac=0.8, N=N2)
     2137    buoy[0:N2,:] = buoy1v
     2138
     2139    # signs
     2140    N3 = N - N2 - 1
     2141    lsign = height*hsigns*2.
     2142   
     2143    Height = np.max(buoy1v[:,0])
     2144    triu = p_angle_triangle(N=N3)
     2145    sign = triu*lsign
     2146    buoy[N2+1:N2+2+N3,:] = sign + [Height+0.2*lsign,-lsign/2.]
     2147
     2148    # painting it
     2149    buoy = ma.masked_equal(buoy, gen.fillValueF)
     2150
     2151    buoysecs = ['buoy', 'sign', 'quarter1', 'quarter2', 'quarter3', 'quarter4']
     2152    buoydic = {'buoy': [buoy[0:N2,:],'-','r',1.5],                                   \
     2153      'sign': [buoy[N2+1:N2+N3+1,:],'-','r',1.5]}
     2154
     2155    return buoy, buoysecs, buoydic
     2156
    21182157####### ####### ##### #### ### ## #
    21192158# Plotting
Note: See TracChangeset for help on using the changeset viewer.