Skip to content

Commit

Permalink
feat: support for NEN5104, update GEF properties (#294)
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas Versteeg <t@versteeg.email>
  • Loading branch information
RDWimmers and tversteeg authored Mar 7, 2023
1 parent 0ea9c35 commit a1dde0c
Show file tree
Hide file tree
Showing 19 changed files with 1,401 additions and 143 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,11 @@ coverage run -m pytest
Requirements are autogenerated by `pip-compile` with python 3.9

```bash
pip-compile --extra=test --extra=docs --extra=lint --output-file=requirements.txt pyproject.toml
pip-compile --extra=test --extra=docs --extra=lint --extra=map --output-file=requirements.txt pyproject.toml
```

To update the requirements within the defined ranges, run:

```bash
pip-compile --upgrade --extra=test --extra=docs --extra=lint --extra=map --output-file=requirements.txt pyproject.toml
```
52 changes: 41 additions & 11 deletions docs/tree/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@
import polars
Getting started
===============
Installing pygef
==================
To install :code:`pygef`, we strongly recommend using Python Package Index (PyPI).
You can install :code:`pygef` with:

.. code-block:: bash
pip install pygef[map]
We installed the `map` variant of :code:`pygef` which include additional dependencies,
and thereby enable additional functionality.

How to import pygef
===================

Getting started with pygef is easy done by importing the :code:`pygef` library:

.. ipython:: python
from pygef import read_cpt, read_bore
import pygef
or any equivalent :code:`import` statement.

Expand All @@ -31,7 +43,7 @@ If you want to use the :code:`path` then your code should look like this:
path_cpt = os.path.join(
os.environ.get("DOC_PATH"), "../tests/test_files/cpt_xml/example.xml"
)
cpt = read_cpt(path_cpt)
cpt = pygef.read_cpt(path_cpt)
Access the attributes
---------------------
Expand Down Expand Up @@ -80,7 +92,7 @@ If we call :code:`BoreData.data` on a :code:`BoreData` object we will get someth
path_bore = os.path.join(
os.environ.get("DOC_PATH"), "../tests/test_files/bore_xml/DP14+074_MB_KR.xml"
)
bore = read_bore(path_bore)
bore = pygef.read_bore(path_bore)
bore.data
Expand All @@ -96,10 +108,8 @@ If we use the method without arguments on a :code:`cpt` object we get:
.. ipython:: python
:okwarning:
from pygef import plot_cpt
@savefig cpt_plot.png
plot_cpt(cpt)
pygef.plotting.plot_cpt(cpt)
Borehole
Expand All @@ -109,7 +119,27 @@ If we use the method without arguments on a :code:`BoreData` object we get:
.. ipython:: python
:okwarning:
from pygef import plot_bore
@savefig bore_plot.png
plot_bore(bore)
pygef.plotting.plot_bore(bore)
Combine Borehole an CPT
........................

.. ipython:: python
:okwarning:
# parse BRO bhrgt XML
path_bore = os.path.join(
os.environ.get("DOC_PATH"), "../tests/test_files/bore_xml/BHR000000336600.xml"
)
bore = pygef.read_bore(path_bore)
# parse BRO CPT XML
path_cpt = os.path.join(
os.environ.get("DOC_PATH"), "../tests/test_files/cpt_xml/CPT000000155283.xml"
)
cpt = pygef.read_cpt(path_cpt)
@savefig bore_cpt_plot.png
pygef.plotting.plot_merge(bore, cpt)
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pygef"
version = "0.8.0a4"
version = "0.8.0a5"
description = "Parse soil measurument data."
dependencies = [
"polars[pyarrow]>=0.14.28",
Expand Down Expand Up @@ -36,6 +36,7 @@ lint = [
"black",
"isort",
]
map = ["contextily>=1.3.0"]

[tool.pytest.ini_options]
pythonpath = ["src"]
Expand Down Expand Up @@ -77,6 +78,7 @@ module = [
"numpy.*",
"gef_file_to_map.*",
"pytest.*",
"setuptools.*"
"setuptools.*",
"contextily.*"
]
ignore_missing_imports = true
68 changes: 55 additions & 13 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,45 @@
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# pip-compile --extra=docs --extra=lint --extra=test --output-file=requirements.txt pyproject.toml
# pip-compile --extra=docs --extra=lint --extra=map --extra=test --output-file=requirements.txt pyproject.toml
#
affine==2.4.0
# via rasterio
alabaster==0.7.13
# via sphinx
asteroid-sphinx-theme==0.0.3
# via pygef (pyproject.toml)
asttokens==2.2.1
# via stack-data
attrs==22.2.0
# via pytest
# via
# pytest
# rasterio
babel==2.12.1
# via sphinx
backcall==0.2.0
# via ipython
black==23.1.0
# via pygef (pyproject.toml)
certifi==2022.12.7
# via requests
charset-normalizer==3.0.1
# via
# rasterio
# requests
charset-normalizer==3.1.0
# via requests
click==8.1.3
# via black
# via
# black
# click-plugins
# cligj
# mercantile
# rasterio
click-plugins==1.1.1
# via rasterio
cligj==0.7.2
# via rasterio
contextily==1.3.0
# via pygef (pyproject.toml)
contourpy==1.0.7
# via matplotlib
coverage==6.5.0
Expand All @@ -48,6 +65,10 @@ fonttools==4.38.0
# via matplotlib
gef-file-to-map==0.1.0
# via pygef (pyproject.toml)
geographiclib==2.0
# via geopy
geopy==2.3.0
# via contextily
idna==3.4
# via requests
imagesize==1.4.1
Expand All @@ -66,23 +87,31 @@ jedi==0.18.2
# via ipython
jinja2==3.1.2
# via sphinx
joblib==1.2.0
# via contextily
kiwisolver==1.4.4
# via matplotlib
lxml==4.9.1
# via pygef (pyproject.toml)
markupsafe==2.1.2
# via jinja2
matplotlib==3.7.0
# via pygef (pyproject.toml)
matplotlib==3.7.1
# via
# contextily
# pygef (pyproject.toml)
matplotlib-inline==0.1.6
# via ipython
mercantile==1.2.1
# via contextily
mypy-extensions==1.0.0
# via black
numpy==1.24.2
# via
# contourpy
# matplotlib
# pyarrow
# rasterio
# snuggs
packaging==23.0
# via
# black
Expand All @@ -98,12 +127,14 @@ pexpect==4.8.0
pickleshare==0.7.5
# via ipython
pillow==9.4.0
# via matplotlib
platformdirs==3.0.0
# via
# contextily
# matplotlib
platformdirs==3.1.0
# via black
pluggy==1.0.0
# via pytest
polars[pyarrow]==0.16.9
polars[pyarrow]==0.16.11
# via pygef (pyproject.toml)
prompt-toolkit==3.0.38
# via ipython
Expand All @@ -118,19 +149,28 @@ pygments==2.14.0
# ipython
# sphinx
pyparsing==3.0.9
# via matplotlib
pytest==7.2.1
# via
# matplotlib
# snuggs
pytest==7.2.2
# via pygef (pyproject.toml)
python-dateutil==2.8.2
# via matplotlib
rasterio==1.3.6
# via contextily
requests==2.28.2
# via
# contextily
# coveralls
# sphinx
six==1.16.0
# via python-dateutil
# via
# asttokens
# python-dateutil
snowballstemmer==2.2.0
# via sphinx
snuggs==1.4.7
# via rasterio
sphinx==6.1.3
# via
# asteroid-sphinx-theme
Expand Down Expand Up @@ -173,6 +213,8 @@ urllib3==1.26.14
# via requests
wcwidth==0.2.6
# via prompt-toolkit
xyzservices==2023.2.0
# via contextily
zipp==3.15.0
# via
# importlib-metadata
Expand Down
5 changes: 2 additions & 3 deletions src/pygef/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from pygef import plotting
from pygef._version import __version__
from pygef.plotting import plot_bore, plot_cpt
from pygef.shim import read_bore, read_cpt

__all__ = [
"__version__",
"plot_cpt",
"plot_bore",
"plotting",
"read_cpt",
"read_bore",
]
3 changes: 3 additions & 0 deletions src/pygef/bore.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@

@dataclass
class BoreData:
# dispatch_document bhrgt
bro_id: str | None
research_report_date: date
description_procedure: str
delivered_location: Location
standardized_location: Location | None
delivered_vertical_position_offset: float | None
delivered_vertical_position_datum: str
delivered_vertical_position_reference_point: str
Expand Down
Loading

0 comments on commit a1dde0c

Please sign in to comment.