@@ -94,12 +94,10 @@ def plot_mesh_vals(
9494 The axes with the plot.
9595 """
9696
97- # Copy coordinates to avoid modifying original mesh
9897 crd = np .array (msh_t .vert2 ["coord" ], copy = True )
9998 cnn = msh_t .tria3 ["index" ]
10099 val = msh_t .value .flatten ()
101100
102- # Transform to geographic coordinates if needed
103101 if to_geo is not None :
104102 crd [:, 0 ], crd [:, 1 ] = to_geo (crd [:, 0 ], crd [:, 1 ])
105103
@@ -426,17 +424,6 @@ def simply_polygon(base_shape: Polygon, simpl_UTM: float, project) -> Polygon:
426424 -------
427425 Polygon
428426 The simplified polygon in geographic coordinates.
429-
430- Examples
431- --------
432- >>> from shapely.geometry import Polygon
433- >>> from pyproj import Transformer
434- >>> from shapely.ops import transform
435- >>> base_shape = Polygon([(0, 0), (1, 1), (1, 0), (0, 0)])
436- >>> project = Transformer.from_crs("EPSG:4326", "EPSG:32630").transform
437- >>> simpl_UTM = 100.0 # Simplification tolerance in meters
438- >>> simplified_shape = simply_polygon(base_shape, simpl_UTM, project)
439- >>> print(simplified_shape)
440427 """
441428
442429 base_shape_utm = transform (project , base_shape )
@@ -471,17 +458,6 @@ def remove_islands(base_shape: Polygon, threshold_area: float, project) -> Polyg
471458 -------
472459 Polygon
473460 The polygon with small interior rings removed, transformed back to geographic coordinates.
474-
475- Examples
476- --------
477- >>> from shapely.geometry import Polygon
478- >>> from pyproj import Transformer
479- >>> from shapely.ops import transform
480- >>> base_shape = Polygon([(0, 0), (1, 1), (1, 0), (0, 0)])
481- >>> project = Transformer.from_crs("EPSG:4326", "EPSG:32630").transform
482- >>> threshold_area = 100.0 # Minimum area for interior rings in square meters
483- >>> simplified_shape = remove_islands(base_shape, threshold_area, project)
484- >>> print(simplified_shape)
485461 """
486462
487463 base_shape_utm = transform (project , base_shape )
@@ -552,17 +528,6 @@ def calculate_edges(Elmts: np.ndarray) -> np.ndarray:
552528 np.ndarray
553529 A 2D array of shape (n_edges, 2) containing the unique edges,
554530 each represented by a pair of node indices.
555-
556- Examples
557- --------
558- >>> Elmts = np.array([[0, 1, 2], [1, 2, 3], [2, 0, 3]])
559- >>> edges = calculate_edges(Elmts)
560- >>> print(edges)
561- [[0 1]
562- [0 2]
563- [1 2]
564- [1 3]
565- [2 3]]
566531 """
567532
568533 perc = 0
@@ -901,15 +866,6 @@ def compute_circumcenter(p0: np.ndarray, p1: np.ndarray, p2: np.ndarray) -> np.n
901866 -------
902867 np.ndarray
903868 2D coordinates of the circumcenter.
904-
905- Examples
906- --------
907- >>> p0 = np.array([0, 0])
908- >>> p1 = np.array([1, 0])
909- >>> p2 = np.array([0, 1])
910- >>> center = compute_circumcenter(p0, p1, p2)
911- >>> print(center)
912- [0.5 0.5]
913869 """
914870
915871 A = p1 - p0
@@ -943,13 +899,6 @@ def build_edge_to_cells(elements: np.ndarray) -> Dict[Tuple[int, int], List[int]
943899 -------
944900 edge_to_cells : Dict[Tuple[int, int], List[int]]
945901 Dictionary mapping edges to the list of adjacent element indices.
946-
947- Examples
948- --------
949- >>> elements = np.array([[0, 1, 2], [1, 2, 3], [2, 0, 3]])
950- >>> edge_to_cells = build_edge_to_cells(elements)
951- >>> print(edge_to_cells)
952- {(0, 1): [0], (0, 2): [0, 2], (1, 2): [0, 1], (1, 3): [1], (2, 3): [1]}
953902 """
954903
955904 edge_to_cells = defaultdict (list )
@@ -985,15 +934,6 @@ def detect_circumcenter_too_close(
985934 -------
986935 bad_elements_mask : np.ndarray
987936 Boolean mask indicating which elements are problematic (True if bad).
988-
989- Examples
990- --------
991- >>> X = np.array([0, 1, 0, 1])
992- >>> Y = np.array([0, 0, 1, 1])
993- >>> elements = np.array([[0, 1, 2], [1, 3, 2]])
994- >>> bad_elements = detect_circumcenter_too_close(X, Y, elements, aj_threshold=0.1)
995- >>> print(bad_elements)
996- [False False]
997937 """
998938
999939 nodes = np .column_stack ((X , Y ))
@@ -1155,15 +1095,3 @@ def get_raster_resolution_meters(lon_center, lat_center, raster_resolution, proj
11551095 ]
11561096 )
11571097 return raster_resolution_meters
1158-
1159-
1160- if __name__ == "__main__" :
1161- # Example usage
1162- from pyproj import Transformer
1163- from shapely .geometry import Polygon
1164-
1165- base_shape = Polygon ([(0 , 0 ), (1 , 1 ), (1 , 0 ), (0 , 0 )])
1166- project = Transformer .from_crs ("EPSG:4326" , "EPSG:32630" ).transform
1167- simpl_UTM = 100.0 # Simplification tolerance in meters
1168- simplified_shape = simply_polygon (base_shape , simpl_UTM , project )
1169- print (simplified_shape )
0 commit comments