Skip to content

Commit

Permalink
Merge pull request #226 from cgre-aachen/dev_gemgis2
Browse files Browse the repository at this point in the history
1.0.2
  • Loading branch information
AlexanderJuestel committed Dec 29, 2022
2 parents 856c844 + dd9561b commit e15527b
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 58 deletions.
21 changes: 11 additions & 10 deletions CITATION.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
If you use GemGIS for any published work, please cite it using the reference
below:

@misc{GemGIS2020,
author = {Alexander Magnus Juestel and Arthur Endlein Correira and Jan Florian Wellmann and Marius Pischke},
organization = {Department for Computational Geoscience and Reservoir Engineering - RWTH Aachen University},
title = {GemGIS – GemPy Geographic: Open-Source Spatial Data Processing for Geological Modeling},
year = {2021--},
url = {https://doi.org/10.5194/egusphere-egu21-4613},
howpublished = {\url{https://github.com/cgre-aachen/gemgis}},
note = {EGU General Assembly 2021}

}
@article{Jüstel2022,
doi = {10.21105/joss.03709},
url = {https://doi.org/10.21105/joss.03709},
year = {2022}, publisher = {The Open Journal},
volume = {7},
number = {73},
pages = {3709},
author = {Alexander Jüstel and Arthur Endlein Correira and Marius Pischke and Miguel de la Varga and Florian Wellmann},
title = {GemGIS - Spatial Data Processing for Geomodeling},
journal = {Journal of Open Source Software}
}
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

We attempt to simplify the access to open-source spatial data processing for geological modeling with the development of **GemGIS, a Python-based open-source library**.

GemGIS wraps and extends the functionality of packages known to the geo-community such as [GeoPandas](https://geopandas.org/), [rasterio](https://rasterio.readthedocs.io/en/latest/#), [OWSLib](https://geopython.github.io/OWSLib/), [Shapely](https://shapely.readthedocs.io/en/latest/manual.html), [PyGEOS](https://pygeos.readthedocs.io/en/latest/), [PyVista](https://docs.pyvista.org/), [Pandas](https://pandas.pydata.org/), [NumPy](https://numpy.org/) and the geomodeling package [GemPy](https://docs.gempy.org/).
GemGIS wraps and extends the functionality of packages known to the geo-community such as [GeoPandas](https://geopandas.org/), [rasterio](https://rasterio.readthedocs.io/en/latest/#), [OWSLib](https://geopython.github.io/OWSLib/), [Shapely](https://shapely.readthedocs.io/en/latest/manual.html), [PyVista](https://docs.pyvista.org/), [Pandas](https://pandas.pydata.org/), [NumPy](https://numpy.org/) and the geomodeling package [GemPy](https://docs.gempy.org/).

The aim of GemGIS, as indicated by the name, is to become a bridge between conventional geoinformation systems (GIS) such as ArcGIS and QGIS, and geomodeling tools such as GemPy, allowing simpler and more automated workflows from one environment to the other. This also includes making it simpler to visualize the results obtained from GemGIS and GemPy with PyVista or Blender.

Expand All @@ -37,12 +37,10 @@ Furthermore, many [example models](https://gemgis.readthedocs.io/en/latest/getti

<a name="installation"></a>
## Installation
It is recommended to use GemGIS with **python==3.9** in a separated environment. The main packages and its dependencies can be installed via the conda-forge channel. GemGIS is then available through PyPi.
1) `conda install -c conda-forge pygeos`
2) `conda install -c conda-forge geopandas`
3) `conda install -c conda-forge rasterio`
4) `conda install -c conda-forge pyvista`
5) `pip install gemgis` / `conda install -c conda-forge gemgis`
It is recommended to use GemGIS with **python">=3.10"** in a separated environment. The main packages and its dependencies can be installed via the conda-forge channel. GemGIS is then available through PyPi or Conda.
1) `conda install -c conda-forge geopandas">=0.12.2" rasterio">=1.3.4"`
2) `conda install -c conda-forge pyvista">=0.37.0"`
3) `pip install gemgis` / `conda install -c conda-forge gemgis`

Check out the [Installation Page](https://gemgis.readthedocs.io/en/latest/getting_started/installation.html) for more detailed instructions.

Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ About

GemGIS is a Python-based, open-source geographic information processing library. It is capable of preprocessing spatial data such as vector data (shape files, geojson files, geopackages,...), raster data (tif, png,...), data obtained from online services (WCS, WMS, WFS) or XML/KML files (soon). Preprocessed data can be stored in a dedicated Data Class to be passed to the geomodeling package `GemPy <https://github.com/cgre-aachen/gempy>`_ in order to accelerate the model building process. Postprocessing of model results will allow export from GemPy to geoinformation systems such as QGIS and ArcGIS or to Google Earth for further use.

GemGIS uses and combines the full functionality of `GeoPandas <https://geopandas.org/>`_, `rasterio <https://rasterio.readthedocs.io/en/latest/>`_, `OWSLib <https://geopython.github.io/OWSLib/>`_, `Pandas <https://pandas.pydata.org/docs/>`_, `Shapely <https://shapely.readthedocs.io/en/latest/manual.html>`_, `PyGEOS <https://pygeos.readthedocs.io/>`_, `PyVista <https://docs.pyvista.org/>`_ and `NumPy <https://numpy.org/>`_ to simplify, accelerate and automate the workflows used to preprocess spatial data for geomodeling.
GemGIS uses and combines the full functionality of `GeoPandas <https://geopandas.org/>`_, `rasterio <https://rasterio.readthedocs.io/en/latest/>`_, `OWSLib <https://geopython.github.io/OWSLib/>`_, `Pandas <https://pandas.pydata.org/docs/>`_, `Shapely <https://shapely.readthedocs.io/en/latest/manual.html>`_, `PyVista <https://docs.pyvista.org/>`_ and `NumPy <https://numpy.org/>`_ to simplify, accelerate and automate the workflows used to preprocess spatial data for geomodeling.

.. image:: images/cover.png

Expand Down
20 changes: 11 additions & 9 deletions docs/getting_started/authors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ below:

.. code::
@misc{GemGIS2020,
author = {Alexander Magnus Juestel and Arthur Endlein Correira and Jan Florian Wellmann and Marius Pischke},
organization = {Department for Computational Geoscience and Reservoir Engineering - RWTH Aachen University},
title = {GemGIS – GemPy Geographic: Open-Source Spatial Data Processing for Geological Modeling},
year = {2021--},
url = {https://doi.org/10.5194/egusphere-egu21-4613},
howpublished = {\url{https://github.com/cgre-aachen/gemgis}},
note = {EGU General Assembly 2021}
}
@article{Jüstel2022,
doi = {10.21105/joss.03709},
url = {https://doi.org/10.21105/joss.03709},
year = {2022}, publisher = {The Open Journal},
volume = {7},
number = {73},
pages = {3709},
author = {Alexander Jüstel and Arthur Endlein Correira and Marius Pischke and Miguel de la Varga and Florian Wellmann},
title = {GemGIS - Spatial Data Processing for Geomodeling},
journal = {Journal of Open Source Software}
}
License
~~~~~~~
Expand Down
Binary file modified docs/getting_started/images/cmd1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/getting_started/images/cmd6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions docs/getting_started/installation.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.. _installation_ref:

Installation
Installation (Tested 2023-01-01)
===========================================================

GemGIS is supported on Python version 3.8.5 . Previous versions are officially not supported.
GemGIS is supported on Python version 3.10. Previous versions are officially not supported.

It is recommended to consider using Anaconda as a virtual environment and package manager for Python. The following installation instructions work with Anaconda.

Expand All @@ -25,7 +25,7 @@ It is recommended to create a new virtual environment when using GemGIS to avoid

Creating a new environment in Anaconda with fixed Python version::

conda create -n gemgis python==3.9
conda create -n gemgis python==3.10

Click ``y`` if you are asked to proceed.

Expand Down Expand Up @@ -94,17 +94,17 @@ GemGIS and all its dependencies can be installed via conda-forge::
Installing GemGIS and its dependencies manually
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Two of the main packages that GemGIS is dependent on are `rasterio <https://rasterio.readthedocs.io/en/latest/>`_ and `GeoPandas <https://geopandas.org/>`_. It is recommended to install these packages separately as they both depend on the `GDAL <https://gdal.org/>`_ translator library for raster and vector geospatial data. In addition, the PyGEOS library is needed to make value of operations acting on arrays of geometries rather than single geometries.
Two of the main packages that GemGIS is dependent on are `rasterio <https://rasterio.readthedocs.io/en/latest/>`_ and `GeoPandas <https://geopandas.org/>`_. It is recommended to install these packages separately as they both depend on the `GDAL <https://gdal.org/>`_ translator library for raster and vector geospatial data. In addition, many smaller libraries like shaply or fiona will also be installed properly.

Install the latest versions of PyGEOS, GeoPandas and Rasterio::
Install the latest versions of GeoPandas and Rasterio (as of 2023-01-01). Please mind the quotation marks that are necessary when specifying the version numbers.::

conda install -c conda-forge pygeos geopandas rasterio
conda install -c conda-forge geopandas">=0.12.2" rasterio">=1.3.4"

.. image:: images/cmd6.png

In order to visualize and work with meshes, the `PyVista <https://docs.pyvista.org/>`_ package is being installed::

conda install -c conda-forge pyvista
conda install -c conda-forge pyvista">=0.37.0"


Installing GemPy (Optional)
Expand Down
9 changes: 4 additions & 5 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: gemgis_env
channels:
- conda-forge
dependencies:
- python>=3.7
- pygeos=0.9
- geopandas=0.9
- rasterio=1.2.1
- pyvista=0.29
- python>=3.10
- geopandas=0.12.2
- rasterio=1.3.4
- pyvista=0.37.0
- pip
- pip:
- gemgis
9 changes: 4 additions & 5 deletions gemgis/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,19 @@ def load_pdf(path: str,
data = open(path, 'rb')

# Create new PdfFileReader object
filereader = PyPDF2.PdfFileReader(data)
filereader = PyPDF2.PdfReader(data)

# Get Number of Pages
number_of_pages = filereader.getNumPages()
number_of_pages = len(filereader.pages)

# Create empty string to store page content
page_content = ''

# Retrieve page content for each page
for i in tqdm(range(number_of_pages)):
text = filereader.getPage(pageNumber=i)

text = filereader.pages[i]
# Add text to page content
page_content += text.extractText()
page_content += text.extract_text()

# Saving a txt-file of the retrieved page content for further usage
if save_as_txt:
Expand Down
6 changes: 3 additions & 3 deletions gemgis/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ def create_polydata_from_msh(data: Dict[str, np.ndarray]) -> pv.core.pointset.Po


def create_polydata_from_ts(data: Tuple[list, list],
concat: bool = None) -> pv.core.pointset.PolyData:
concat: bool = False) -> pv.core.pointset.PolyData:
""" Convert loaded GoCAD mesh to PyVista PolyData
Parameters
Expand Down Expand Up @@ -1063,9 +1063,9 @@ def create_polydata_from_ts(data: Tuple[list, list],
raise TypeError('Concat parameter must either be True or False')

# Checking that the faces and vertices are of the correct type
if not isinstance(data[0], pd.DataFrame):
if not isinstance(data[0], list):
raise TypeError('The vertices are in the wrong format. Check your input data')
if not isinstance(data[1], np.ndarray):
if not isinstance(data[1], list):
raise TypeError('The faces are in the wrong format. Check your input data')

if concat:
Expand Down
Binary file removed tests/test
Binary file not shown.
16 changes: 8 additions & 8 deletions tests/test_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2415,7 +2415,7 @@ def test_extract_z_rasterio(gdf_randompoints1, dem):
331.0111444924173]
assert gdf_z['Y'].head().tolist() == [902.0868083698422, 120.8290807190565, -140.9983501274578, 618.5767934183793,
255.6839742805063]
assert gdf_z['Z'].head().tolist() == [700.2296752929688, -3.402823e+38, -3.402823e+38, 500.2345275878906,
assert gdf_z['Z'].head().tolist() == [700.2296752929688, -3.4028230607370965e+38, -3.4028230607370965e+38, 500.2345275878906,
499.8694763183594]


Expand Down Expand Up @@ -2458,7 +2458,7 @@ def test_extract_z_rasterio_drop_id(gdf_randompoints1, dem):
331.0111444924173]
assert gdf_z['Y'].head().tolist() == [902.0868083698422, 120.8290807190565, -140.9983501274578, 618.5767934183793,
255.6839742805063]
assert gdf_z['Z'].head().tolist() == [700.2296752929688, -3.402823e+38, -3.402823e+38, 500.2345275878906,
assert gdf_z['Z'].head().tolist() == [700.2296752929688, -3.4028230607370965e+38, -3.4028230607370965e+38, 500.2345275878906,
499.8694763183594]


Expand Down Expand Up @@ -4014,7 +4014,7 @@ def test_create_buffer_point():
assert isinstance(point, Point)
assert isinstance(polygon, Polygon)
try:
assert polygon.area == 78.41371226364848
assert polygon.area == 78.41371226364852
except AssertionError:
assert polygon.area == 78.41371226364849

Expand Down Expand Up @@ -4504,7 +4504,7 @@ def test_calculate_coordinates_for_point_on_cross_section():
point=point)

assert isinstance(coordinates, Point)
assert coordinates.wkt == 'POINT (3.535533905932737 3.535533905932737)'
assert coordinates.wkt == 'POINT (3.5355339059327373 3.5355339059327373)'


# Testing calculate_coordinates_for_linestring_on_straight_cross_sections
Expand All @@ -4522,7 +4522,7 @@ def test_calculate_coordinates_for_linestring_on_straight_cross_sections():
assert isinstance(points, list)
assert all(isinstance(n, Point) for n in points)
assert len(points) == 2
assert points[0].wkt == 'POINT (3.535533905932737 3.535533905932737)'
assert points[0].wkt == 'POINT (3.5355339059327373 3.5355339059327373)'
assert points[1].wkt == 'POINT (4.242640687119285 4.242640687119285)'


Expand All @@ -4542,7 +4542,7 @@ def test_calculate_coordinates_for_linestrings_on_straight_cross_sections():
assert isinstance(points, list)
assert all(isinstance(n, Point) for n in points)
assert len(points) == 4
assert points[0].wkt == 'POINT (3.535533905932737 3.535533905932737)'
assert points[0].wkt == 'POINT (3.5355339059327373 3.5355339059327373)'
assert points[1].wkt == 'POINT (4.242640687119285 4.242640687119285)'
assert points[2].wkt == 'POINT (2.82842712474619 2.82842712474619)'
assert points[3].wkt == 'POINT (4.949747468305833 4.949747468305833)'
Expand Down Expand Up @@ -4790,7 +4790,7 @@ def test_calculate_orientation_from_cross_section():
midpoint = calculate_midpoint_linestring(orientation_linestring)
assert midpoint.wkt == 'POINT (3 -1.5)'

assert orientation[0].wkt == 'POINT (2.683281572999747 1.341640786499874)'
assert orientation[0].wkt == 'POINT (2.6832815729997472 1.3416407864998736)'
assert orientation[1] == -1.5
assert orientation[2] == 56.309932474020215
assert orientation[3] == 63.43494882292201
Expand Down Expand Up @@ -4854,7 +4854,7 @@ def test_calculate_orientation_from_bent_cross_section():
interfaces=orientation_linestring)

assert points[0].wkt == 'POINT (5.707106781186548 0.7071067811865475)'
assert points[1].wkt == 'POINT (7.121320343559642 2.121320343559642)'
assert points[1].wkt == 'POINT (7.121320343559642 2.1213203435596424)'

assert orientation[0].wkt == 'POINT (6.414213562373095 1.414213562373095)'
assert orientation[1] == -1
Expand Down
3 changes: 2 additions & 1 deletion tests/test_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ def test_create_polydata_from_ts():

data = read_ts('../docs/getting_started/tutorial/data/test_visualization/KVB_12_Hermann_Katharina.ts')

mesh = create_polydata_from_ts(data=data)
mesh = create_polydata_from_ts(data=data,
concat=False)

assert isinstance(mesh, pv.core.pointset.PolyData)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,10 @@ def test_load_wfs():
assert wfs['iwan:L382'].title == 'Seismik 3D'
try:
assert wfs['iwan:L382'].boundingBoxWGS84 == (
5.395175801132899, 47.16510247399335, 17.002272548448747, 54.85398076006902)
5.395175801132899, 47.16510247399334, 17.002272548448747, 54.85398076006902)
except AssertionError:
assert wfs['iwan:L382'].boundingBoxWGS84 == (
5.395175801132899, 47.16510247399334, 17.002272548448747, 54.85398076006903)
5.395175801132899, 47.16510247399335, 17.002272548448747, 54.85398076006903)

assert [op.name for op in wfs.operations] == ['GetCapabilities', 'DescribeFeatureType', 'GetFeature']
assert wfs.getOperationByName('GetFeature').formatOptions == ['{http://www.opengis.net/wfs}GML2']
Expand Down

0 comments on commit e15527b

Please sign in to comment.