Simple parser for *.gef files. These are ASCII based files used for soil properties measurements. Compatible with Python 3.9.
Recently added the parsing of xml boreholes file, the xml parsing is still in a preliminary phase, not all the files are supported. If you find a file that doesn't work with pygef, please make an issue about it or PR :)
Latest stable version:
$ pip install pygef
Cutting-edge version (might break):
$ pip install git+https://github.com/cemsbv/pygef.git
>> > from pygef import read_cpt
>> > # read gef and xml files
>> > cpt_data = read_cpt("./my-cpt.xml")
>> > cpt_data
CPTData: {'bro_id': 'CPT000000099543',
'cone_diameter': 44,
'cone_surface_area': 1500,
'cone_surface_quotient': 0.67,
'cone_to_friction_sleeve_distance': 100,
'cone_to_friction_sleeve_surface_area': 22530,
'cone_to_friction_sleeve_surface_quotient': 1.0,
...
'zlm_pore_pressure_u3_after': None,
'zlm_pore_pressure_u3_before': None}
>> > # access the underlying polars DataFrame under the `data` attribute
>> > cpt_data.data.head()
shape: (5, 9)
ββββββββββββββ¬ββββββββ¬ββββββββββββ¬βββββββββββββ¬ββββββ¬βββββββββββββ¬βββββββββββββ¬βββββββββββββ¬βββββββββββββ
β penetratio β depth β elapsedTi β coneResist β ... β inclinatio β inclinatio β localFrict β frictionRa β
β nLength β --- β me β ance β β nNS β nResultant β ion β tio β
β --- β f64 β --- β --- β β --- β --- β --- β --- β
β f64 β β f64 β f64 β β i64 β i64 β f64 β f64 β
ββββββββββββββͺββββββββͺββββββββββββͺβββββββββββββͺββββββͺβββββββββββββͺβββββββββββββͺβββββββββββββͺβββββββββββββ‘
β 0.0 β 0.0 β -9.99999
e β -9.99999e5 β ... β -999999 β -999999 β -9.99999e5 β -9.99999e5 β
β β β 5 β β β β β β β
ββββββββββββββΌββββββββΌββββββββββββΌβββββββββββββΌββββββΌβββββββββββββΌβββββββββββββΌβββββββββββββΌβββββββββββββ€
β 0.02 β 0.02 β 11.0 β 2.708 β ... β 0 β 0 β 0.03 β 0.6 β
ββββββββββββββΌββββββββΌββββββββββββΌβββββββββββββΌββββββΌβββββββββββββΌβββββββββββββΌβββββββββββββΌβββββββββββββ€
β 0.04 β 0.039 β 13.0 β 4.29 β ... β 0 β 0 β 0.039 β 0.8 β
ββββββββββββββΌββββββββΌββββββββββββΌβββββββββββββΌββββββΌβββββββββββββΌβββββββββββββΌβββββββββββββΌβββββββββββββ€
β 0.06 β 0.059 β 15.0 β 5.124 β ... β 0 β 0 β 0.045 β 0.9 β
ββββββββββββββΌββββββββΌββββββββββββΌβββββββββββββΌββββββΌβββββββββββββΌβββββββββββββΌβββββββββββββΌβββββββββββββ€
β 0.08 β 0.079 β 17.0 β 5.45 β ... β 0 β 0 β 0.049 β 1.0 β
ββββββββββββββ΄ββββββββ΄ββββββββββββ΄βββββββββββββ΄ββββββ΄βββββββββββββ΄βββββββββββββ΄βββββββββββββ΄βββββββββββββ
>> > from pygef import read_bore
>> > # read gef and xml files
>> > bore_data = read_bore("./my-bore.xml")
>> > bore_data
BoreData: {'bore_hole_completed': True,
'bore_rock_reached': False,
'data': (13, 8),
'delivered_location': Location(srs_name='urn:ogc:def:crs:EPSG::28992', x=158322.139, y=444864.706),
'delivered_vertical_position_datum': 'nap',
'delivered_vertical_position_offset': 10.773,
'delivered_vertical_position_reference_point': 'maaiveld',
'description_procedure': 'ISO14688d1v2019c2020',
'final_bore_depth': 12.0,
'final_sample_depth': 12.0,
'research_report_date': datetime.date(2021, 10, 19)}
>> > # access the underlying polars DataFrame under the `data` attribute
>> > bore_data.data.head()
shape: (5, 8)
ββββββββββββββ¬βββββββββββββ¬βββββββββββββ¬βββββββββββ¬βββββββββββββ¬βββββββββββββ¬βββββββββββββ¬ββββββββββ
β upper_boun β lower_boun β geotechnic β color β dispersed_ β organic_ma β sand_media β soil_di β
β dary β dary β al_soil_na β --- β inhomogeni β tter_conte β n_class β st β
β --- β --- β me β str β ty β nt_class β --- β --- β
β f64 β f64 β --- β β --- β --- β str β list[f6 β
β β β str β β bool β str β β 4] β
ββββββββββββββͺβββββββββββββͺβββββββββββββͺβββββββββββͺβββββββββββββͺβββββββββββββͺβββββββββββββͺββββββββββ‘
β 0.0 β 1.0 β zwakGrindi β donkergr β false β nietOrgani β middelgrof β [0.2, β
β β β gZand β ijs β β sch β 420
tot630u β 0.0, β
β β β β β β β m β ... β
β β β β β β β β 0.0] β
ββββββββββββββΌβββββββββββββΌβββββββββββββΌβββββββββββΌβββββββββββββΌβββββββββββββΌβββββββββββββΌββββββββββ€
β 1.0 β 1.1 β zwakGrindi β donkergr β false β nietOrgani β middelgrof β [0.2, β
β β β gZand β ijs β β sch β 420
tot630u β 0.0, β
β β β β β β β m β ... β
β β β β β β β β 0.0] β
ββββββββββββββΌβββββββββββββΌβββββββββββββΌβββββββββββΌβββββββββββββΌβββββββββββββΌβββββββββββββΌββββββββββ€
β 1.1 β 2.0 β zwakZandig β standaar β false β nietOrgani β null β [0.0, β
β β β eKleiMetGr β dBruin β β sch β β 0.1, β
β β β ind β β β β β ... β
β β β β β β β β 0.0] β
ββββββββββββββΌβββββββββββββΌβββββββββββββΌβββββββββββΌβββββββββββββΌβββββββββββββΌβββββββββββββΌββββββββββ€
β 2.0 β 3.0 β zwakZandig β standaar β false β nietOrgani β null β [0.0, β
β β β eKlei β dGrijs β β sch β β 0.0, β
β β β β β β β β ... β
β β β β β β β β 0.0] β
ββββββββββββββΌβββββββββββββΌβββββββββββββΌβββββββββββΌβββββββββββββΌβββββββββββββΌβββββββββββββΌββββββββββ€
β 3.0 β 4.0 β zwakZandig β donkergr β false β nietOrgani β null β [0.0, β
β β β eKlei β ijs β β sch β β 0.0, β
β β β β β β β β ... β
β β β β β β β β 0.0] β
ββββββββββββββ΄βββββββββββββ΄βββββββββββββ΄βββββββββββ΄βββββββββββββ΄βββββββββββββ΄βββββββββββββ΄ββββββββββ
from pygef import read_cpt, read_bore
from pygef.plotting import plot_cpt, plot_bore
# plot cpt file
plot_cpt(read_cpt("myfile.xml"))
# plot a bore file
plot_bore(read_bore("myfile.xml"))
Build the docs:
python -m pip install --upgrade pip setuptools
pip install -r requirements.txt
pip install .
sphinx-build -b html docs public
We format our code with black and isort.
black --config "pyproject.toml" .
isort --settings-path "pyproject.toml" .
To maintain code quality we use the GitHub super-linter.
To run the linters locally, run the following bash script from the root directory:
docker run \
--env VALIDATE_ALL_CODEBASE=false \
--env RUN_LOCAL=true \
--env VALIDATE_JSCPD=false \
--env VALIDATE_CSS=false \
--env VALIDATE_BASH=false \
--env VALIDATE_YAML=false \
--env VALIDATE_PYTHON_PYLINT=false \
--env VALIDATE_NATURAL_LANGUAGE=false \
--env VALIDATE_MARKDOWN=false \
--env LINTER_RULES_PATH=/ \
--env PYTHON_BLACK_CONFIG_FILE=pyproject.toml \
--env PYTHON_ISORT_CONFIG_FILE=pyproject.toml \
--env PYTHON_MYPY_CONFIG_FILE=pyproject.toml \
--env PYTHON_FLAKE8_CONFIG_FILE=.flake8 \
-v $(pwd):/tmp/lint ghcr.io/super-linter/super-linter:v6
Test the software with the use of coverage:
python -m pip install --upgrade pip setuptools
pip install -r requirements.txt
pip install .
coverage run -m pytest
Requirements are autogenerated by pip-compile
with python 3.9
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:
pip-compile --upgrade --extra=test --extra=docs --extra=lint --extra=map --output-file=requirements.txt pyproject.toml
Automatically upgrade your Polars code so it's compatible with future versions.
pip install -U polars-upgrade
polars-upgrade src/pygef tests --target-version=0.19.19