From f7a7784e61f443a268cdd0ed42d4acbd8b680329 Mon Sep 17 00:00:00 2001 From: AlexanderJuestel Date: Sat, 30 Sep 2023 11:04:42 +0200 Subject: [PATCH] Edits --- ...splaying_seismic_horizons_and_faults.ipynb | 32 ++++++++++++++++++- environment_dev.yml | 1 + gemgis/download_gemgis_data.py | 12 +++++-- gemgis/misc.py | 29 +++++++---------- gemgis/raster.py | 11 +++++-- gemgis/vector.py | 2 +- 6 files changed, 64 insertions(+), 23 deletions(-) diff --git a/docs/getting_started/tutorial/65_displaying_seismic_horizons_and_faults.ipynb b/docs/getting_started/tutorial/65_displaying_seismic_horizons_and_faults.ipynb index 1964567c..9ece4e25 100644 --- a/docs/getting_started/tutorial/65_displaying_seismic_horizons_and_faults.ipynb +++ b/docs/getting_started/tutorial/65_displaying_seismic_horizons_and_faults.ipynb @@ -2211,6 +2211,7 @@ } ], "metadata": { + "hide_input": false, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", @@ -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, diff --git a/environment_dev.yml b/environment_dev.yml index fd3efeb0..ef9075bd 100644 --- a/environment_dev.yml +++ b/environment_dev.yml @@ -43,3 +43,4 @@ dependencies: - sphinx_automodapi - sphinx_numfig - numpydoc + - build diff --git a/gemgis/download_gemgis_data.py b/gemgis/download_gemgis_data.py index 1c0b62e7..a96c4d98 100644 --- a/gemgis/download_gemgis_data.py +++ b/gemgis/download_gemgis_data.py @@ -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 @@ -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 diff --git a/gemgis/misc.py b/gemgis/misc.py index 73443594..fb853405 100644 --- a/gemgis/misc.py +++ b/gemgis/misc.py @@ -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 @@ -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 @@ -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 diff --git a/gemgis/raster.py b/gemgis/raster.py index 44c564a1..8f619bec 100644 --- a/gemgis/raster.py +++ b/gemgis/raster.py @@ -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 @@ -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 @@ -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) @@ -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], diff --git a/gemgis/vector.py b/gemgis/vector.py index 506339ee..1047e322 100644 --- a/gemgis/vector.py +++ b/gemgis/vector.py @@ -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 _______