Skip to content

Commit

Permalink
Edits
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderJuestel committed Sep 30, 2023
1 parent 5beb306 commit f7a7784
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,7 @@
}
],
"metadata": {
"hide_input": false,
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
Expand All @@ -2226,7 +2227,36 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
"version": "3.8.5"
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
Expand Down
1 change: 1 addition & 0 deletions environment_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ dependencies:
- sphinx_automodapi
- sphinx_numfig
- numpydoc
- build
12 changes: 10 additions & 2 deletions gemgis/download_gemgis_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ def create_pooch(storage_url: str,
Base URL for the remote data source.
files : List[str]
A record of the files that are managed by this Pooch.
target : str, default: ''
target : str, default: ``''``
The path to the local data storage folder, e.g. ``target='Documents/gemgis/'``.
Returns
_______
pooch.core.Pooch
Pooch class.
See also
________
download_tutorial_data: Download the GemGIS data for each tutorial.
"""
try:
import pooch
Expand All @@ -67,11 +71,15 @@ def download_tutorial_data(filename: str,
__________
filename : str
File name to be downloaded by pooch, e.g. ``filename='file.zip'``.
dirpath : str, default: ''
dirpath : str, default: ``''``
Path to the directory where the data is being stored, default to the directory where the notebook is
located, e.g. ``dirpath='Documents/gemgis/'``.
storage_url : str, default 'https://rwth-aachen.sciebo.de/s/AfXRsZywYDbUF34/download?path=%2F'
URL to the GemGIS data storage, default is the RWTH Aachen University Sciebo Cloud Storage.
See also
________
create_pooch : Create pooch class to fetch files from a website.
"""
try:
import pooch
Expand Down
29 changes: 12 additions & 17 deletions gemgis/misc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Contributors: Alexander Jüstel, Arthur Endlein Correia, Florian Wellmann, Marius Pischke
Contributors: Alexander Jüstel, Arthur Endlein Correia, Florian Wellmann, Marius Pischke.
GemGIS is a Python-based, open-source spatial data processing library.
It is capable of preprocessing spatial data such as vector data
Expand Down Expand Up @@ -33,23 +33,21 @@

def load_pdf(path: str,
save_as_txt: bool = True) -> str:
"""Function to load pdf containing borehole data
"""
Load PDF file containing borehole data.
Parameters
__________
path : str
Name of the PDF file, e.g. ``path='file.pdf'``
save_as_txt : bool
Name of the PDF file, e.g. ``path='file.pdf'``.
save_as_txt : bool, default: ``True``
Variable to save the extracted data as txt file.
Options include: ``True`` or ``False``, default set to ``True``
Options include: ``True`` or ``False``.
Returns
_______
page_content : str
Extracted page content from borehole data
str
Extracted page content from borehole data.
.. versionadded:: 1.0.x
Expand All @@ -66,14 +64,11 @@ def load_pdf(path: str,
See Also
________
get_meta_data : Getting the meta data of a well
get_meta_data_df : Getting the meta data of wells as DataFrame
get_stratigraphic_data : Getting the stratigraphic data of a well
get_stratigraphic_data_df : Getting the stratigraphic data of wells as DataFrame
get_meta_data : Get the meta data of a well.
get_meta_data_df : Get the meta data of wells as DataFrame.
get_stratigraphic_data : Get the stratigraphic data of a well.
get_stratigraphic_data_df : Get the stratigraphic data of wells as DataFrame.
"""

# Trying to import PyPDF2 but returning error if tqdm is not installed
try:
import PyPDF2
Expand Down
11 changes: 9 additions & 2 deletions gemgis/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -2716,7 +2716,8 @@ def extract_contour_lines_from_raster(raster: Union[rasterio.io.DatasetReader, n
def read_raster_gdb(path: str,
crs: Union[str,
pyproj.crs.crs.CRS,
rasterio.crs.CRS] = None):
rasterio.crs.CRS] = None,
path_out: str = ''):
"""Read Raster from OpenFileGDB.
Parameters
Expand All @@ -2725,6 +2726,8 @@ def read_raster_gdb(path: str,
Path to the OpenFileGDB.
crs : str, pyproj.crs.crs.CRS, rasterio.crs.CRS
Coordinate Reference System of the dataset.
path_out : str
Output folder path
.. versionadded:: 1.1.1
Expand All @@ -2739,6 +2742,10 @@ def read_raster_gdb(path: str,
if not isinstance(path, str):
raise TypeError('Path to the OpenFileGDB must be provided as string')

# Checking that the output path is of type string
if not isinstance(path_out, str):
raise TypeError('Output path must be provided as string')

# Opening Database
ds = gdal.Open(path)

Expand Down Expand Up @@ -2768,7 +2775,7 @@ def read_raster_gdb(path: str,

# Saving raster to file
with rasterio.open(
ds.GetSubDatasets()[i][1].replace(' ', '') + '.tif',
path_out + ds.GetSubDatasets()[i][1].replace(' ', '') + '.tif',
'w',
driver='GTiff',
height=raster.shape[0],
Expand Down
2 changes: 1 addition & 1 deletion gemgis/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def extract_xy(gdf: gpd.geodataframe.GeoDataFrame,
.. versionchanged:: 1.1
If a GeoDataFrame contains LineStrings and MultiLineStrings, the index of the exploded GeoDataFrame will now
be reset. Not resetting the index will cause index errors later on.
be reset. Not resetting the index will cause index errors later on.
Example
_______
Expand Down

0 comments on commit f7a7784

Please sign in to comment.