Changeset 2452 in lmdz_wrf
- Timestamp:
- Apr 21, 2019, 9:55:18 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/geometry_tools.py
r2451 r2452 23 23 # dist_points: Function to provide the distance between two points 24 24 # max_coords_poly: Function to provide the extremes of the coordinates of a polygon 25 # rotate_polygon_2D: Function to rotate 2D plain the vertices of a polygon25 # mirror_polygon: Function to reflex a polygon for a given axis 26 26 # position_sphere: Function to tranform fom a point in lon, lat deg coordinates to 27 27 # cartesian coordinates over an sphere 28 28 # read_join_poly: Function to read an ASCII file with the combination of polygons 29 29 # rotate_2D: Function to rotate a vector by a certain angle in the plain 30 # rotate_polygon_2D: Function to rotate 2D plain the vertices of a polygon 30 31 # rotate_line2D: Function to rotate a line given by 2 pairs of x,y coordinates by a 31 32 # certain angle in the plain … … 257 258 258 259 return [nx, xx], [ny, xy], [ayx, axx], xyx 260 261 def mirror_polygon(polygon,axis): 262 """ Function to reflex a polygon for a given axis 263 polygon: polygon to mirror 264 axis: axis at which mirror is located ('x' or 'y') 265 """ 266 fname = 'mirror_polygon' 267 268 reflex = np.zeros(polygon.shape, dtype=np.float) 269 270 N = polygon.shape[0] 271 if axis == 'x': 272 for iv in range(N): 273 reflex[iv,:] = [-polygon[iv,1], polygon[iv,0]] 274 elif axis == 'y': 275 for iv in range(N): 276 reflex[iv,:] = [polygon[iv,1], -polygon[iv,0]] 277 278 return reflex 259 279 260 280 ####### ###### ##### #### ### ## # … … 484 504 485 505 dangle = 2.*np.pi*loops/(N-1) 486 dr = eradii /(N-1)506 dr = eradii*1./(N-1) 487 507 488 508 for ia in range(N):
Note: See TracChangeset
for help on using the changeset viewer.