Skip to content

Commit b06eb22

Browse files
Update docstrings
1 parent 51bdd66 commit b06eb22

File tree

1 file changed

+80
-74
lines changed

1 file changed

+80
-74
lines changed

gemgis/vector.py

Lines changed: 80 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -8555,12 +8555,12 @@ def create_bbox(extent: List[Union[int, float]]) -> shapely.geometry.polygon.Pol
85558555
Parameters
85568556
----------
85578557
extent : List[Union[int, float]]
8558-
List of minx, maxx, miny, maxy values, e.g. ``extent=[0, 972, 0, 1069]``
8558+
List of minx, maxx, miny, maxy values, e.g. ``extent=[0, 972, 0, 1069]``.
85598559
85608560
Returns
85618561
-------
85628562
bbox : shapely.geometry.polygon.Polygon
8563-
Rectangular polygon based on extent
8563+
Rectangular polygon based on extent.
85648564
85658565
.. versionadded:: 1.0.x
85668566
@@ -8606,33 +8606,33 @@ def set_dtype(
86068606
Parameters
86078607
----------
86088608
gdf : gpd.geodataframe.GeoDataFrame
8609-
GeoDataFrame containing the input vector data with uncorrected dtypes
8609+
GeoDataFrame containing the input vector data with uncorrected dtypes.
86108610
86118611
dip : str
8612-
Name of the column containing the dip data, e.g ``dip='dip'``
8612+
Name of the column containing the dip data, e.g ``dip='dip'``.
86138613
86148614
azimuth : str
8615-
Name of the column containing the azimuth data, e.g ``azimuth='azimuth'``
8615+
Name of the column containing the azimuth data, e.g ``azimuth='azimuth'``.
86168616
86178617
formation : str
8618-
Name of the column containing the formation data, e.g ``formation='formation'``
8618+
Name of the column containing the formation data, e.g ``formation='formation'``.
86198619
86208620
polarity : str
8621-
Name of the column containing the polarity data, e.g ``polarity='polarity'``
8621+
Name of the column containing the polarity data, e.g ``polarity='polarity'``.
86228622
86238623
x : str
8624-
Name of the column containing the x coordinates, e.g ``x='X'``
8624+
Name of the column containing the x coordinates, e.g ``x='X'``.
86258625
86268626
y : str
8627-
Name of the column containing the y coordinates, e.g ``y='Y'``
8627+
Name of the column containing the y coordinates, e.g ``y='Y'``.
86288628
86298629
z : str
8630-
Name of the column containing the z coordinates, e.g ``z='Z'``
8630+
Name of the column containing the z coordinates, e.g ``z='Z'``.
86318631
86328632
Returns
86338633
-------
86348634
gdf : gpd.geodataframe.GeoDataFrame
8635-
GeoDataFrame containing the input vector data with corrected dtypes
8635+
GeoDataFrame containing the input vector data with corrected dtypes.
86368636
86378637
.. versionadded:: 1.0.x
86388638
@@ -8724,20 +8724,20 @@ def create_polygons_from_faces(
87248724
Parameters
87258725
----------
87268726
mesh : pv.core.pointset.PolyData
8727-
PyVista PolyData dataset
8727+
PyVista PolyData dataset.
87288728
87298729
crs : Union[str, pyproj.crs.crs.CRS]
8730-
Name of the CRS provided to reproject coordinates of the GeoDataFrame, e.g. ``crs='EPSG:4647'``
8730+
Name of the CRS provided to reproject coordinates of the GeoDataFrame, e.g. ``crs='EPSG:4647'``.
87318731
87328732
87338733
return_gdf : bool
87348734
Variable to either return the data as GeoDataFrame or as list of LineStrings.
8735-
Options include: ``True`` or ``False``, default set to ``True``
8735+
Options include: ``True`` or ``False``, default set to ``True``.
87368736
87378737
Returns
87388738
-------
87398739
polygons : Union[List[shapely.geometry.polygon.Polygon], gpd.geodataframe.GeoDataFrame]
8740-
Triangular Shapely Polygons representing the faces of the mesh
8740+
Triangular Shapely Polygons representing the faces of the mesh.
87418741
87428742
.. versionadded:: 1.0.x
87438743
@@ -8763,13 +8763,14 @@ def create_polygons_from_faces(
87638763
>>> # Create polygons from mesh faces
87648764
>>> polygons = gg.vector.create_polygons_from_faces(mesh=mesh)
87658765
>>> polygons
8766-
geometry
8767-
0 POLYGON Z ((297077.414 5677487.262 -838.496, 2...
8768-
1 POLYGON Z ((298031.070 5678779.547 -648.688, 2...
8769-
2 POLYGON Z ((297437.539 5676992.094 -816.608, 2...
8770-
3 POLYGON Z ((298031.070 5678779.547 -648.688, 2...
8771-
4 POLYGON Z ((295827.680 5680951.574 -825.328, 2...
8772-
8766+
| Index | Geometry |
8767+
+-------+-----------------------------------------------------+
8768+
| 0 | POLYGON Z ((297077.414 5677487.262 -838.496, 2...)) |
8769+
| 1 | POLYGON Z ((298031.070 5678779.547 -648.688, 2...)) |
8770+
| 2 | POLYGON Z ((297437.539 5676992.094 -816.608, 2...)) |
8771+
| 3 | POLYGON Z ((298031.070 5678779.547 -648.688, 2...)) |
8772+
| 4 | POLYGON Z ((295827.680 5680951.574 -825.328, 2...)) |
8773+
+-------+-----------------------------------------------------+
87738774
"""
87748775
# Checking that the input mesh is a PyVista PolyData dataset
87758776
if not isinstance(mesh, pv.core.pointset.PolyData):
@@ -8811,19 +8812,19 @@ def unify_polygons(
88118812
Parameters
88128813
----------
88138814
polygons : Union[List[shapely.geometry.polygon.Polygon], gpd.geodataframe.GeoDataFrame]
8814-
Triangular Shapely Polygons representing the faces of the mesh
8815+
Triangular Shapely Polygons representing the faces of the mesh.
88158816
88168817
crs : Union[str, pyproj.crs.crs.CRS]
8817-
Name of the CRS provided to reproject coordinates of the GeoDataFrame, e.g. ``crs='EPSG:4647'``
8818+
Name of the CRS provided to reproject coordinates of the GeoDataFrame, e.g. ``crs='EPSG:4647'``.
88188819
88198820
return_gdf : bool
88208821
Variable to either return the data as GeoDataFrame or as list of LineStrings.
8821-
Options include: ``True`` or ``False``, default set to ``True``
8822+
Options include: ``True`` or ``False``, default set to ``True``.
88228823
88238824
Returns
88248825
-------
88258826
polygons_merged : Union[List[shapely.geometry.polygon.Polygon], gpd.geodataframe.GeoDataFrame]
8826-
Merged Shapely Polygons
8827+
Merged Shapely Polygons.
88278828
88288829
.. versionadded:: 1.0.x
88298830
@@ -8834,22 +8835,26 @@ def unify_polygons(
88348835
>>> import geopandas as gpd
88358836
>>> polygons = gpd.read_file(filename='file.shp')
88368837
>>> polygons
8837-
geometry
8838-
0 POLYGON Z ((297077.414 5677487.262 -838.496, 2...
8839-
1 POLYGON Z ((298031.070 5678779.547 -648.688, 2...
8840-
2 POLYGON Z ((297437.539 5676992.094 -816.608, 2...
8841-
3 POLYGON Z ((298031.070 5678779.547 -648.688, 2...
8842-
4 POLYGON Z ((295827.680 5680951.574 -825.328, 2...
8843-
8838+
| Index | Geometry |
8839+
+-------+--------------------------------------------------------------------------+
8840+
| 0 | POLYGON Z ((297077.414 5677487.262 -838.496, 298031.070 5678779.547..... |
8841+
| 1 | POLYGON Z ((298031.070 5678779.547 -648.688, 297437.539 5676992.094......|
8842+
| 2 | POLYGON Z ((297437.539 5676992.094 -816.608, 298031.070 5678779.547......|
8843+
| 3 | POLYGON Z ((298031.070 5678779.547 -648.688, 295827.680 5680951.574......|
8844+
| 4 | POLYGON Z ((295827.680 5680951.574 -825.328, 297077.414 5677487.262......|
8845+
+-------+--------------------------------------------------------------------------+
88448846
>>> # Merging polygons
88458847
>>> polygons_merged = gg.vector.unify_polygons(polygons=polygons)
88468848
>>> polygons_merged
8847-
geometry
8848-
0 POLYGON Z ((396733.222 5714544.109 -186.252, 3...
8849-
1 POLYGON Z ((390252.635 5712409.037 -543.142, 3...
8850-
2 POLYGON Z ((391444.965 5710989.453 -516.000, 3...
8851-
3 POLYGON Z ((388410.007 5710903.900 -85.654, 38...
8852-
4 POLYGON Z ((384393.963 5714293.104 -614.106, 3...
8849+
+----+--------------------------------------------------+
8850+
| | geometry |
8851+
+----+--------------------------------------------------+
8852+
| 0 | POLYGON Z ((396733.222 5714544.109 -186.252, ... |
8853+
| 1 | POLYGON Z ((390252.635 5712409.037 -543.142, ... |
8854+
| 2 | POLYGON Z ((391444.965 5710989.453 -516.000, ... |
8855+
| 3 | POLYGON Z ((388410.007 5710903.900 -85.654, 3... |
8856+
| 4 | POLYGON Z ((384393.963 5714293.104 -614.106, ... |
8857+
+----+--------------------------------------------------+
88538858
88548859
"""
88558860
# Checking that the polygons are of type list of a GeoDataFrame
@@ -8915,19 +8920,17 @@ def unify_linestrings(
89158920
Parameters
89168921
----------
89178922
linestrings : Union[List[shapely.geometry.linestring.LineString], gpd.geodataframe.GeoDataFrame]
8918-
LineStrings consisting of two vertices representing extracted contour lines
8919-
8923+
LineStrings consisting of two vertices representing extracted contour lines.
89208924
crs : Union[str, pyproj.crs.crs.CRS]
8921-
Name of the CRS provided to reproject coordinates of the GeoDataFrame, e.g. ``crs='EPSG:4647'``
8922-
8925+
Name of the CRS provided to reproject coordinates of the GeoDataFrame, e.g. ``crs='EPSG:4647'``.
89238926
return_gdf : bool
89248927
Variable to either return the data as GeoDataFrame or as list of LineStrings.
8925-
Options include: ``True`` or ``False``, default set to ``True``
8928+
Options include: ``True`` or ``False``, default set to ``True``.
89268929
89278930
Returns
89288931
-------
89298932
linestrings_merged : Union[List[shapely.geometry.linestring.LineString], gpd.geodataframe.GeoDataFrame]
8930-
Merged Shapely LineStrings
8933+
Merged Shapely LineStrings.
89318934
89328935
.. versionadded:: 1.0.x
89338936
@@ -8938,22 +8941,28 @@ def unify_linestrings(
89388941
>>> import geopandas as gpd
89398942
>>> linestrings = gpd.read_file(filename='file.shp')
89408943
>>> linestrings
8941-
geometry Z
8942-
0 LINESTRING Z (32409587.930 5780538.824 -2350.0... -2350.00
8943-
1 LINESTRING Z (32407304.336 5777048.086 -2050.0... -2050.00
8944-
2 LINESTRING Z (32408748.977 5778005.047 -2200.0... -2200.00
8945-
3 LINESTRING Z (32403693.547 5786613.994 -2400.0... -2400.00
8946-
4 LINESTRING Z (32404738.664 5782672.480 -2350.0... -2350.00
8944+
+----+--------------------------------------------------+----------+
8945+
| | geometry | Z |
8946+
+----+--------------------------------------------------+----------+
8947+
| 0 | LINESTRING Z (32409587.930 5780538.824 -2350.0) | -2350.00 |
8948+
| 1 | LINESTRING Z (32407304.336 5777048.086 -2050.0) | -2050.00 |
8949+
| 2 | LINESTRING Z (32408748.977 5778005.047 -2200.0) | -2200.00 |
8950+
| 3 | LINESTRING Z (32403693.547 5786613.994 -2400.0) | -2400.00 |
8951+
| 4 | LINESTRING Z (32404738.664 5782672.480 -2350.0) | -2350.00 |
8952+
+----+--------------------------------------------------+----------+
89478953
89488954
>>> # Merging linestrings
89498955
>>> polygons_linestrings = gg.vector.unify_linestrings(linestrings=linestrings)
89508956
>>> polygons_linestrings
8951-
geometry
8952-
0 LINESTRING Z (32331825.641 5708789.973 -200.00...
8953-
1 LINESTRING Z (32334315.359 5723032.766 -250.00...
8954-
2 LINESTRING Z (32332516.312 5722028.768 -250.00...
8955-
3 LINESTRING Z (32332712.750 5721717.561 -250.00...
8956-
4 LINESTRING Z (32332516.312 5722028.768 -250.00...
8957+
+----+--------------------------------------------------+
8958+
| | geometry |
8959+
+----+--------------------------------------------------+
8960+
| 0 | LINESTRING Z (32331825.641 5708789.973 -200.00) |
8961+
| 1 | LINESTRING Z (32334315.359 5723032.766 -250.00) |
8962+
| 2 | LINESTRING Z (32332516.312 5722028.768 -250.00) |
8963+
| 3 | LINESTRING Z (32332712.750 5721717.561 -250.00) |
8964+
| 4 | LINESTRING Z (32332516.312 5722028.768 -250.00) |
8965+
+----+--------------------------------------------------+
89578966
89588967
"""
89598968
# Checking that the linestrings are of type list of a GeoDataFrame
@@ -9016,24 +9025,23 @@ def create_hexagon(center: shapely.geometry.Point, radius: Union[int, float]):
90169025
Parameters
90179026
----------
90189027
center: shapely.geometry.Point
9019-
Shapely Point representing the center of the hexagon
9020-
9028+
Shapely Point representing the center of the hexagon.
90219029
radius: int, float
9022-
Radius of the hexagon
9030+
Radius of the hexagon.
90239031
90249032
Returns
90259033
-------
90269034
geometry.Polygon(hex_coords): shapely.geometry.Polygon
9027-
Shapley Polygon in the shape of a hexagon
9035+
Shapley Polygon in the shape of a hexagon.
90289036
90299037
.. versionadded:: 1.0.x
90309038
90319039
.. versionchanged:: 1.1.3
9032-
Optimized creation of hexagon
9040+
Optimized creation of hexagon.
90339041
90349042
See Also
90359043
--------
9036-
create_hexagon_grid : Creating a hexagon grid
9044+
create_hexagon_grid : Create a hexagon grid.
90379045
90389046
"""
90399047
# Checking that the center point is provided as Shapely Point
@@ -9063,19 +9071,17 @@ def create_hexagon_grid(
90639071
Parameters
90649072
----------
90659073
gdf: gpd.GeoDataFrame
9066-
GeoDataFrame containing the polygons for which a hexagon grid is created
9067-
9074+
GeoDataFrame containing the polygons for which a hexagon grid is created.
90689075
radius: int, float
9069-
Radius of the hexagon
9070-
9076+
Radius of the hexagon.
90719077
crop_gdf: bool
9072-
Boolean to define if the resulting GeoDataFrame should be cropped to the extend of the provided GeoDataFrame
9073-
Options include: ``True`` or ``False``, default set to ``True``
9078+
Boolean to define if the resulting GeoDataFrame should be cropped to the extent of the provided GeoDataFrame.
9079+
Options include: ``True`` or ``False``, default set to ``True``.
90749080
90759081
Returns
90769082
-------
90779083
hex_gdf: gpd.GeoDataFrame
9078-
GeoDataFrame containing the hexagon grid
9084+
GeoDataFrame containing the hexagon grid.
90799085
90809086
.. versionadded:: 1.0.x
90819087
@@ -9084,7 +9090,7 @@ def create_hexagon_grid(
90849090
90859091
See Also
90869092
--------
9087-
create_hexagon : Creating one hexagon based on a given center and radius
9093+
create_hexagon : Create one hexagon based on a given center and radius.
90889094
90899095
"""
90909096
# Checking that the gdf is of type GeoDataFrame
@@ -9161,12 +9167,12 @@ def create_voronoi_polygons(
91619167
Parameters
91629168
----------
91639169
gdf: gpd.geodataframe.GeoDataFrame
9164-
GeoDataFrame containing the Shapely Points
9170+
GeoDataFrame containing the Shapely Points.
91659171
91669172
Returns
91679173
-------
91689174
gdf_polygons: gpd.geodataframe.GeoDataFrame
9169-
GeoDataFrame containing the valid Voronoi Polygons
9175+
GeoDataFrame containing the valid Voronoi Polygons.
91709176
91719177
.. versionadded:: 1.1
91729178
@@ -9180,7 +9186,7 @@ def create_voronoi_polygons(
91809186
91819187
Note
91829188
----
9183-
(https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.Voronoi.html#scipy.spatial.Voronoi)
9189+
https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.Voronoi.html#scipy.spatial.Voronoi
91849190
91859191
"""
91869192
# Checking that the gdf is of type GeoDataFrame

0 commit comments

Comments
 (0)