Skip to content

Commit

Permalink
Bump version; change WindowsPath to Path
Browse files Browse the repository at this point in the history
  • Loading branch information
smknaake committed Oct 16, 2024
1 parent b7aa71a commit 42b142d
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 128 deletions.
2 changes: 1 addition & 1 deletion geost/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# read_xml_soil_cores,
from geost.utils import csv_to_parquet, excel_to_parquet

__version__ = "0.2.4"
__version__ = "0.2.5"
86 changes: 43 additions & 43 deletions geost/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pickle
from pathlib import WindowsPath
from pathlib import Path
from typing import Any, Iterable, List

import geopandas as gpd
Expand Down Expand Up @@ -237,7 +237,7 @@ def select_within_bbox(

def select_with_points(
self,
points: str | WindowsPath | gpd.GeoDataFrame,
points: str | Path | gpd.GeoDataFrame,
buffer: float | int,
invert: bool = False,
):
Expand All @@ -246,7 +246,7 @@ def select_with_points(
Parameters
----------
points : str | WindowsPath | gpd.GeoDataFrame
points : str | Path | gpd.GeoDataFrame
Geodataframe (or file that can be parsed to a geodataframe) to select with.
buffer : float | int
Buffer distance for selection geometries.
Expand All @@ -266,7 +266,7 @@ def select_with_points(

def select_with_lines(
self,
lines: str | WindowsPath | gpd.GeoDataFrame,
lines: str | Path | gpd.GeoDataFrame,
buffer: float | int,
invert: bool = False,
):
Expand All @@ -275,7 +275,7 @@ def select_with_lines(
Parameters
----------
lines : str | WindowsPath | gpd.GeoDataFrame
lines : str | Path | gpd.GeoDataFrame
Geodataframe (or file that can be parsed to a geodataframe) to select with.
buffer : float | int
Buffer distance for selection geometries.
Expand All @@ -295,7 +295,7 @@ def select_with_lines(

def select_within_polygons(
self,
polygons: str | WindowsPath | gpd.GeoDataFrame,
polygons: str | Path | gpd.GeoDataFrame,
buffer: float | int = 0,
invert: bool = False,
):
Expand All @@ -304,7 +304,7 @@ def select_within_polygons(
Parameters
----------
polygons : str | WindowsPath | gpd.GeoDataFrame
polygons : str | Path | gpd.GeoDataFrame
Geodataframe (or file that can be parsed to a geodataframe) to select with.
buffer : float | int, optional
Optional buffer distance around the polygon selection geometries, by default
Expand Down Expand Up @@ -397,7 +397,7 @@ def select_by_length(self, min_length: float = None, max_length: float = None):

def get_area_labels(
self,
polygon_gdf: str | WindowsPath | gpd.GeoDataFrame,
polygon_gdf: str | Path | gpd.GeoDataFrame,
column_name: str,
include_in_header=False,
) -> pd.DataFrame:
Expand All @@ -407,7 +407,7 @@ def get_area_labels(
Parameters
----------
polygon_gdf : str | WindowsPath | gpd.GeoDataFrame
polygon_gdf : str | Path | gpd.GeoDataFrame
GeoDataFrame with polygons.
column_name : str
The column name to find the labels in.
Expand Down Expand Up @@ -968,7 +968,7 @@ def to_multiblock(

def to_vtm(
self,
outfile: str | WindowsPath,
outfile: str | Path,
data_columns: str | List[str],
radius: float = 1,
vertical_factor: float = 1.0,
Expand All @@ -981,7 +981,7 @@ def to_vtm(
Parameters
----------
outfile : str | WindowsPath
outfile : str | Path
Path to vtm file to be written.
data_columns : str | List[str]
Name or names of data columns to include for visualisation. Can be columns that
Expand Down Expand Up @@ -1014,7 +1014,7 @@ def to_vtm(
def to_datafusiontools(
self,
columns: List[str],
outfile: str | WindowsPath = None,
outfile: str | Path = None,
encode: bool = False,
relative_to_vertical_reference: bool = True,
):
Expand All @@ -1032,7 +1032,7 @@ def to_datafusiontools(
columns : List[str]
Which columns in the data to include for the export. These will become variables
in the DataFusionTools "Data" class.
outfile : str | WindowsPath, optional
outfile : str | Path, optional
If a path to outfile is given, the data is written to a pickle file.
encode : bool, default True
If True, categorical data columns are encoded to additional binary columns
Expand Down Expand Up @@ -1136,7 +1136,7 @@ def _create_geodataframe_3d(

def to_qgis3d(
self,
outfile: str | WindowsPath,
outfile: str | Path,
relative_to_vertical_reference: bool = True,
crs: str | int | CRS = None,
**kwargs,
Expand All @@ -1147,7 +1147,7 @@ def to_qgis3d(
Parameters
----------
outfile : str | WindowsPath
outfile : str | Path
Path to geopackage file to be written.
relative_to_vertical_reference : bool, optional
If True, the depth of all data objects will converted to a depth with
Expand All @@ -1167,7 +1167,7 @@ def to_qgis3d(

def to_kingdom(
self,
outfile: str | WindowsPath,
outfile: str | Path,
tdstart: int = 1,
vw: float = 1500.0,
vs: float = 1600.0,
Expand All @@ -1178,7 +1178,7 @@ def to_kingdom(
Parameters
----------
outfile : str | WindowsPath
outfile : str | Path
Path to csv file to be written.
tdstart : int
startindex for TDchart, default is 1
Expand Down Expand Up @@ -1693,7 +1693,7 @@ def select_within_bbox(

def select_with_points(
self,
points: str | WindowsPath | gpd.GeoDataFrame,
points: str | Path | gpd.GeoDataFrame,
buffer: float | int,
invert: bool = False,
):
Expand All @@ -1702,7 +1702,7 @@ def select_with_points(
Parameters
----------
points : str | WindowsPath | gpd.GeoDataFrame
points : str | Path | gpd.GeoDataFrame
Geodataframe (or file that can be parsed to a geodataframe) to select with.
buffer : float | int
Buffer distance for selection geometries.
Expand All @@ -1722,7 +1722,7 @@ def select_with_points(

def select_with_lines(
self,
lines: str | WindowsPath | gpd.GeoDataFrame,
lines: str | Path | gpd.GeoDataFrame,
buffer: float | int,
invert: bool = False,
):
Expand All @@ -1731,7 +1731,7 @@ def select_with_lines(
Parameters
----------
lines : str | WindowsPath | gpd.GeoDataFrame
lines : str | Path | gpd.GeoDataFrame
Geodataframe (or file that can be parsed to a geodataframe) to select with.
buffer : float | int
Buffer distance for selection geometries.
Expand All @@ -1751,7 +1751,7 @@ def select_with_lines(

def select_within_polygons(
self,
polygons: str | WindowsPath | gpd.GeoDataFrame,
polygons: str | Path | gpd.GeoDataFrame,
buffer: float | int = 0,
invert: bool = False,
):
Expand All @@ -1760,7 +1760,7 @@ def select_within_polygons(
Parameters
----------
polygons : str | WindowsPath | gpd.GeoDataFrame
polygons : str | Path | gpd.GeoDataFrame
Geodataframe (or file that can be parsed to a geodataframe) to select with.
buffer : float | int, optional
Optional buffer distance around the polygon selection geometries, by default
Expand Down Expand Up @@ -2028,7 +2028,7 @@ def select_by_condition(self, condition: Any, invert: bool = False):

def get_area_labels(
self,
polygon_gdf: str | WindowsPath | gpd.GeoDataFrame,
polygon_gdf: str | Path | gpd.GeoDataFrame,
column_name: str,
include_in_header=False,
) -> pd.DataFrame:
Expand All @@ -2038,7 +2038,7 @@ def get_area_labels(
Parameters
----------
polygon_gdf : str | WindowsPath | gpd.GeoDataFrame
polygon_gdf : str | Path | gpd.GeoDataFrame
GeoDataFrame with polygons.
column_name : str
The column name to find the labels in.
Expand All @@ -2057,60 +2057,60 @@ def get_area_labels(
)
return result

def to_geoparquet(self, outfile: str | WindowsPath, **kwargs):
def to_geoparquet(self, outfile: str | Path, **kwargs):
"""
Write header data to geoparquet. You can use the resulting file to display
borehole locations in GIS for instance. Please note that Geoparquet is supported
by GDAL >= 3.5. For Qgis this means QGis >= 3.26
Parameters
----------
file : str | WindowsPath
file : str | Path
Path to shapefile to be written.
**kwargs
gpd.GeoDataFrame.to_parquet kwargs. See relevant Pandas documentation.
"""
self.header.to_geoparquet(outfile, **kwargs)

def to_shape(self, outfile: str | WindowsPath, **kwargs):
def to_shape(self, outfile: str | Path, **kwargs):
"""
Write header data to shapefile. You can use the resulting file to display
borehole locations in GIS for instance.
Parameters
----------
file : str | WindowsPath
file : str | Path
Path to shapefile to be written.
**kwargs
gpd.GeoDataFrame.to_file kwargs. See relevant GeoPandas documentation.
"""
self.header.to_shape(outfile, **kwargs)

def to_geopackage(self, outfile: str | WindowsPath, **kwargs):
def to_geopackage(self, outfile: str | Path, **kwargs):
"""
Write header data to geopackage. You can use the resulting file to display
borehole locations in GIS for instance.
Parameters
----------
file : str | WindowsPath
file : str | Path
Path to geopackage to be written.
**kwargs
gpd.GeoDataFrame.to_file kwargs. See relevant GeoPandas documentation.
"""
self.header.to_geopackage(outfile, **kwargs)

def to_parquet(self, outfile: str | WindowsPath, data_table: bool = True, **kwargs):
def to_parquet(self, outfile: str | Path, data_table: bool = True, **kwargs):
"""
Export the data or header table to a parquet file. By default the data table is
exported.
Parameters
----------
file : str | WindowsPath
file : str | Path
Path to parquet file to be written.
data_table : bool, optional
If True, the data table is exported. If False, the header table is exported.
Expand All @@ -2131,14 +2131,14 @@ def to_parquet(self, outfile: str | WindowsPath, data_table: bool = True, **kwar
else:
self.header.to_parquet(outfile, **kwargs)

def to_csv(self, outfile: str | WindowsPath, data_table: bool = True, **kwargs):
def to_csv(self, outfile: str | Path, data_table: bool = True, **kwargs):
"""
Export the data or header table to a csv file. By default the data table is
exported.
Parameters
----------
file : str | WindowsPath
file : str | Path
Path to csv file to be written.
data_table : bool, optional
If True, the data table is exported. If False, the header table is exported.
Expand Down Expand Up @@ -2199,7 +2199,7 @@ def to_multiblock(

def to_vtm(
self,
outfile: str | WindowsPath,
outfile: str | Path,
data_columns: str | List[str],
radius: float = 1,
vertical_factor: float = 1.0,
Expand All @@ -2212,7 +2212,7 @@ def to_vtm(
Parameters
----------
outfile : str | WindowsPath
outfile : str | Path
Path to vtm file to be written.
data_columns : str | List[str]
Name or names of data columns to include for visualisation. Can be columns that
Expand Down Expand Up @@ -2244,7 +2244,7 @@ def to_vtm(
def to_datafusiontools(
self,
columns: List[str],
outfile: str | WindowsPath = None,
outfile: str | Path = None,
encode: bool = False,
relative_to_vertical_reference: bool = True,
):
Expand All @@ -2262,7 +2262,7 @@ def to_datafusiontools(
columns : List[str]
Which columns in the data to include for the export. These will become variables
in the DataFusionTools "Data" class.
outfile : str | WindowsPath, optional
outfile : str | Path, optional
If a path to outfile is given, the data is written to a pickle file.
encode : bool, default True
If True, categorical data columns are encoded to additional binary columns
Expand Down Expand Up @@ -2409,7 +2409,7 @@ def get_layer_top(

def to_qgis3d(
self,
outfile: str | WindowsPath,
outfile: str | Path,
relative_to_vertical_reference: bool = True,
**kwargs,
):
Expand All @@ -2419,7 +2419,7 @@ def to_qgis3d(
Parameters
----------
outfile : str | WindowsPath
outfile : str | Path
Path to geopackage file to be written.
relative_to_vertical_reference : bool, optional
If True, the depth of all data objects will converted to a depth with respect to
Expand All @@ -2440,7 +2440,7 @@ def to_qgis3d(

def to_kingdom(
self,
outfile: str | WindowsPath,
outfile: str | Path,
tdstart: int = 1,
vw: float = 1500.0,
vs: float = 1600.0,
Expand All @@ -2451,7 +2451,7 @@ def to_kingdom(
Parameters
----------
out_file : str | WindowsPath
out_file : str | Path
Path to csv file to be written.
tdstart : int
startindex for TDchart, default is 1
Expand Down
Loading

0 comments on commit 42b142d

Please sign in to comment.