Skip to content

Commit bfbd01e

Browse files
Merge pull request #304 from cgre-aachen/dev_gemgis3
Dev gemgis3
2 parents 5ecbc45 + 9a95aeb commit bfbd01e

15 files changed

+95
-36
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ share/python-wheels/
100100
*.egg-info/
101101
.installed.cfg
102102
*.egg
103+
.idea/*
103104

104105
# PyInstaller
105106
# Usually these files are written by a python script from a template
@@ -239,3 +240,5 @@ examples/models/data/*
239240
examples/notebooks/data/*
240241
gemgis/__pycache__
241242
__pycache__
243+
244+
_version_generated.py

MANIFEST.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ include README.md
33
include requirements.txt
44
include requirements_dev.txt
55

6-
recursive-exclude * __pycache__
6+
recursive-exclude * __pycache__
7+
8+
exclude .git/* .idea/*

docs/conf.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
copyright = "2020–2023, GemGIS Developers"
1717
author = 'Alexander Juestel'
1818

19-
# The full version, including alpha/beta/rc tags
20-
release = '1.1.1'
21-
version = release
19+
2220

2321
# -- GemGIS configuration ---------------------------------------------------
2422
import os
@@ -29,6 +27,12 @@
2927
sys.path.insert(0, os.path.abspath("../gemgis/"))
3028
sys.path.insert(0, os.path.abspath("../../gemgis/"))
3129

30+
# The full version, including alpha/beta/rc tags
31+
32+
import gemgis as gg
33+
34+
version = gg.__version__
35+
3236
# -- General configuration ---------------------------------------------------
3337

3438
# Add any Sphinx extension module names here, as strings. They can be
Loading

docs/getting_started/tutorial/65_displaying_seismic_horizons_and_faults.ipynb

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2211,6 +2211,7 @@
22112211
}
22122212
],
22132213
"metadata": {
2214+
"hide_input": false,
22142215
"kernelspec": {
22152216
"display_name": "Python 3 (ipykernel)",
22162217
"language": "python",
@@ -2226,7 +2227,36 @@
22262227
"name": "python",
22272228
"nbconvert_exporter": "python",
22282229
"pygments_lexer": "ipython3",
2229-
"version": "3.10.11"
2230+
"version": "3.8.5"
2231+
},
2232+
"varInspector": {
2233+
"cols": {
2234+
"lenName": 16,
2235+
"lenType": 16,
2236+
"lenVar": 40
2237+
},
2238+
"kernels_config": {
2239+
"python": {
2240+
"delete_cmd_postfix": "",
2241+
"delete_cmd_prefix": "del ",
2242+
"library": "var_list.py",
2243+
"varRefreshCmd": "print(var_dic_list())"
2244+
},
2245+
"r": {
2246+
"delete_cmd_postfix": ") ",
2247+
"delete_cmd_prefix": "rm(",
2248+
"library": "var_list.r",
2249+
"varRefreshCmd": "cat(var_dic_list()) "
2250+
}
2251+
},
2252+
"types_to_exclude": [
2253+
"module",
2254+
"function",
2255+
"builtin_function_or_method",
2256+
"instance",
2257+
"_Feature"
2258+
],
2259+
"window_display": false
22302260
}
22312261
},
22322262
"nbformat": 4,

docs/getting_started/tutorial/71_Opening_Rasters_From_OpenFileGDB.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"source": [
88
"# 71 Opening Rasters from OpenFileGDB\n",
99
"\n",
10-
"This notebook illustrates how to open rasters that are stored in OpenFileGDBs. Currently, QGIS can open rasters from OpenFileGDBs since version 3.32. GeoPandas and the underlying fiona package are capable of opening vector files from OpenFileGDBs. It is not planned to support raster files (https://github.com/geopandas/geopandas/issues/2793). It is not planned to implement that feature into rasterio either (https://github.com/rasterio/rasterio/discussions/2914). Therefore, the decision was made to implement the functionality to open rasters from OpenFileGDBs directly using the `gdal` package. "
10+
"This notebook illustrates how to open rasters that are stored in OpenFileGDBs. Currently, QGIS can open rasters from OpenFileGDBs since version 3.32. GeoPandas and the underlying fiona package are capable of opening vector files from OpenFileGDBs. It is not planned to support raster files (https://github.com/geopandas/geopandas/issues/2793). It is not planned to implement that feature into rasterio either (https://github.com/rasterio/rasterio/discussions/2914). Therefore, the decision was made to implement the functionality to open rasters from OpenFileGDBs directly using the `gdal` package. \n",
11+
"\n",
12+
"<img src=\"../images/tutorial71_cover.png\">"
1113
]
1214
},
1315
{

environment_dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ dependencies:
4343
- sphinx_automodapi
4444
- sphinx_numfig
4545
- numpydoc
46+
- build

gemgis/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
__version_date__ = '2023-09-23'
2222

23-
__version__ = '1.1.1'
24-
2523
__changelog__ = """What is new in version 1.1.0:
2624
2725

gemgis/download_gemgis_data.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,17 @@ def create_pooch(storage_url: str,
3535
Base URL for the remote data source.
3636
files : List[str]
3737
A record of the files that are managed by this Pooch.
38-
target : str, default: ''
38+
target : str, default: ``''``
3939
The path to the local data storage folder, e.g. ``target='Documents/gemgis/'``.
4040
4141
Returns
4242
_______
4343
pooch.core.Pooch
4444
Pooch class.
45+
46+
See also
47+
________
48+
download_tutorial_data: Download the GemGIS data for each tutorial.
4549
"""
4650
try:
4751
import pooch
@@ -67,11 +71,15 @@ def download_tutorial_data(filename: str,
6771
__________
6872
filename : str
6973
File name to be downloaded by pooch, e.g. ``filename='file.zip'``.
70-
dirpath : str, default: ''
74+
dirpath : str, default: ``''``
7175
Path to the directory where the data is being stored, default to the directory where the notebook is
7276
located, e.g. ``dirpath='Documents/gemgis/'``.
7377
storage_url : str, default 'https://rwth-aachen.sciebo.de/s/AfXRsZywYDbUF34/download?path=%2F'
7478
URL to the GemGIS data storage, default is the RWTH Aachen University Sciebo Cloud Storage.
79+
80+
See also
81+
________
82+
create_pooch : Create pooch class to fetch files from a website.
7583
"""
7684
try:
7785
import pooch

gemgis/misc.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Contributors: Alexander Jüstel, Arthur Endlein Correia, Florian Wellmann, Marius Pischke
2+
Contributors: Alexander Jüstel, Arthur Endlein Correia, Florian Wellmann, Marius Pischke.
33
44
GemGIS is a Python-based, open-source spatial data processing library.
55
It is capable of preprocessing spatial data such as vector data
@@ -33,23 +33,21 @@
3333

3434
def load_pdf(path: str,
3535
save_as_txt: bool = True) -> str:
36-
"""Function to load pdf containing borehole data
36+
"""
37+
Load PDF file containing borehole data.
3738
3839
Parameters
3940
__________
40-
4141
path : str
42-
Name of the PDF file, e.g. ``path='file.pdf'``
43-
44-
save_as_txt : bool
42+
Name of the PDF file, e.g. ``path='file.pdf'``.
43+
save_as_txt : bool, default: ``True``
4544
Variable to save the extracted data as txt file.
46-
Options include: ``True`` or ``False``, default set to ``True``
45+
Options include: ``True`` or ``False``.
4746
4847
Returns
4948
_______
50-
51-
page_content : str
52-
Extracted page content from borehole data
49+
str
50+
Extracted page content from borehole data.
5351
5452
.. versionadded:: 1.0.x
5553
@@ -66,14 +64,11 @@ def load_pdf(path: str,
6664
6765
See Also
6866
________
69-
70-
get_meta_data : Getting the meta data of a well
71-
get_meta_data_df : Getting the meta data of wells as DataFrame
72-
get_stratigraphic_data : Getting the stratigraphic data of a well
73-
get_stratigraphic_data_df : Getting the stratigraphic data of wells as DataFrame
74-
67+
get_meta_data : Get the meta data of a well.
68+
get_meta_data_df : Get the meta data of wells as DataFrame.
69+
get_stratigraphic_data : Get the stratigraphic data of a well.
70+
get_stratigraphic_data_df : Get the stratigraphic data of wells as DataFrame.
7571
"""
76-
7772
# Trying to import PyPDF2 but returning error if tqdm is not installed
7873
try:
7974
import PyPDF2

gemgis/raster.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2716,7 +2716,8 @@ def extract_contour_lines_from_raster(raster: Union[rasterio.io.DatasetReader, n
27162716
def read_raster_gdb(path: str,
27172717
crs: Union[str,
27182718
pyproj.crs.crs.CRS,
2719-
rasterio.crs.CRS] = None):
2719+
rasterio.crs.CRS] = None,
2720+
path_out: str = ''):
27202721
"""Read Raster from OpenFileGDB.
27212722
27222723
Parameters
@@ -2725,6 +2726,8 @@ def read_raster_gdb(path: str,
27252726
Path to the OpenFileGDB.
27262727
crs : str, pyproj.crs.crs.CRS, rasterio.crs.CRS
27272728
Coordinate Reference System of the dataset.
2729+
path_out : str
2730+
Output folder path
27282731
27292732
.. versionadded:: 1.1.1
27302733
@@ -2739,6 +2742,10 @@ def read_raster_gdb(path: str,
27392742
if not isinstance(path, str):
27402743
raise TypeError('Path to the OpenFileGDB must be provided as string')
27412744

2745+
# Checking that the output path is of type string
2746+
if not isinstance(path_out, str):
2747+
raise TypeError('Output path must be provided as string')
2748+
27422749
# Opening Database
27432750
ds = gdal.Open(path)
27442751

@@ -2768,7 +2775,7 @@ def read_raster_gdb(path: str,
27682775

27692776
# Saving raster to file
27702777
with rasterio.open(
2771-
ds.GetSubDatasets()[i][1].replace(' ', '') + '.tif',
2778+
path_out + ds.GetSubDatasets()[i][1].replace(' ', '') + '.tif',
27722779
'w',
27732780
driver='GTiff',
27742781
height=raster.shape[0],

gemgis/vector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ def extract_xy(gdf: gpd.geodataframe.GeoDataFrame,
623623
624624
.. versionchanged:: 1.1
625625
If a GeoDataFrame contains LineStrings and MultiLineStrings, the index of the exploded GeoDataFrame will now
626-
be reset. Not resetting the index will cause index errors later on.
626+
be reset. Not resetting the index will cause index errors later on.
627627
628628
Example
629629
_______

gemgis/visualization.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ def convert_to_rgb(array: np.ndarray) -> np.ndarray:
797797
def drape_array_over_dem(array: np.ndarray,
798798
dem: Union[rasterio.io.DatasetReader, np.ndarray],
799799
extent: List[Union[float, int]] = None,
800-
zmax: Union[float, int] = 1000,
800+
zmax: Union[float, int] = 10000,
801801
resize_array: bool =True):
802802
"""Creating grid and texture to drape array over a digital elevation model
803803
@@ -834,6 +834,10 @@ def drape_array_over_dem(array: np.ndarray,
834834
.. versionchanged:: 1.1
835835
Function now allows rasters with different sizes and resizes one of the rasters automatically
836836
837+
.. versionchanged:: 1.1.2
838+
Edit zmax value and fixing a bug with the scikit-image resize function,
839+
see https://github.com/cgre-aachen/gemgis/issues/303
840+
837841
Example
838842
_______
839843
@@ -921,10 +925,12 @@ def drape_array_over_dem(array: np.ndarray,
921925

922926
if resize_array:
923927
array = resize(image=array,
928+
preserve_range=True,
924929
output_shape=(dem.shape[0],
925930
dem.shape[1]))
926931
else:
927932
dem = resize(image=dem,
933+
preserve_range=True,
928934
output_shape=(array.shape[0],
929935
array.shape[1]))
930936

pyproject.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ requires = ["setuptools>=68.1.2",
33
"setuptools_scm[toml]>=6.2"]
44
build-backend = "setuptools.build_meta"
55

6+
[tool.setuptools]
7+
package-dir = { "" = "gemgis" }
8+
69
[project]
710
name = "GemGIS"
811

@@ -17,8 +20,8 @@ description = "Spatial data processing for geomodeling"
1720
keywords = ["dataprocessing", "modeling", "geospatial", "geographic-data", "spatial-data", "rasterdata", "vectordata",
1821
"geographic", "geomodeling"]
1922
readme = "README.md"
20-
license = {file = LICENSE}
21-
dynamic = ["Version"]
23+
license = {file = "LICENSE"}
24+
dynamic = ['version']
2225
requires-python = ">=3.8"
2326
classifiers = [
2427
'Development Status :: 5 - Production/Stable',
@@ -32,9 +35,9 @@ classifiers = [
3235
'Operating System :: OS Independent',
3336
]
3437
dependencies = [
35-
geopandas,
36-
rasterio,
37-
pyvista,
38+
'geopandas',
39+
'rasterio',
40+
'pyvista',
3841
]
3942
[project.urls]
4043
Documentation = 'https://gemgis.readthedocs.io/'

setup.py renamed to xsetup.py

File renamed without changes.

0 commit comments

Comments
 (0)