Changeset 2496 in lmdz_wrf for trunk/tools
- Timestamp:
- May 2, 2019, 1:33:01 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/geometry_tools.py
r2495 r2496 52 52 # z_boat: Function to define an schematic boat from the z-plane 53 53 # zsailing_boat: Function to define an schematic sailing boat from the z-plane with sails 54 54 # zisland1: Function to draw an island from z-axis as the union of a series of points by 55 # circular segments 55 56 ## Plotting 56 57 # plot_sphere: Function to plot an sphere and determine which standard lines will be … … 889 890 return sailingboat, sailingboatsecs, dicsailingboat 890 891 892 def zisland1(mainpts= np.array([[-0.1,0.], [-1.,1.], [-0.8,1.2], [0.1,0.6], [1., 0.9],\ 893 [2.8, -0.1], [0.1,-0.6]], dtype=np.float), radfrac=3., N=200): 894 """ Function to draw an island from z-axis as the union of a series of points by 895 circular segments 896 mainpts: main points of the island (clockwise ordered, to be joined by 897 circular segments of radii as the radfrac factor of the distance between 898 consecutive points) 899 * default= np.array([[-0.1,0.], [-1.,1.], [-0.8,1.2], [0.1,0.6], [1., 0.9], 900 [2.8, -0.1], [0.1,-0.6]], dtype=np.float) 901 radfrac: multiplicative factor of the distance between consecutive points to 902 draw the circular segment (3., default) 903 N: number of points (200, default) 904 """ 905 import numpy.ma as ma 906 fname = 'zisland1' 907 908 island1 = np.ones((N,2), dtype=np.float)*gen.fillValueF 909 910 # Coastline 911 912 # main points 913 lmainpts = list(mainpts) 914 Npts = len(lmainpts) 915 Np = int(N/(Npts+1)) 916 for ip in range(Npts-1): 917 dps = dist_points(lmainpts[ip], lmainpts[ip+1]) 918 island1[Np*ip:Np*(ip+1),:] = circ_sec(lmainpts[ip], mainpts[ip+1], \ 919 dps*radfrac, Np) 920 921 Np2 = N - (Npts-1)*Np 922 dps = dist_points(lmainpts[Npts-1], lmainpts[0]) 923 island1[(Npts-1)*Np:N,:] = circ_sec(lmainpts[Npts-1], lmainpts[0], dps*3., Np2) 924 925 islandsecs = ['coastline'] 926 islanddic = {'coastline': [island1, '-', '#161616', 2.]} 927 928 island1 = ma.masked_equal(island1, gen.fillValueF) 929 930 return island1, islandsecs, islanddic 931 891 932 def write_join_poly(polys, flname='join_polygons.dat'): 892 933 """ Function to write an ASCII file with the combination of polygons
Note: See TracChangeset
for help on using the changeset viewer.