 [](https://github.com/ambv/black) [](https://codecov.io/gh/ahartikainen/pyinfraformat)
# pyinfraformat
Python library for reading, writing and analyzing Finnish borehole format Infraformat (version 2.5).
Well suited for scientific and research applications.
## Installation
Latest (stable) `pyinfraformat` can be installed with pip
python -m pip install pyinfraformat
The latest (unstable) version can be installed from git with pip (needs git-tools).
python -m pip install git+https://github.com/ahartikainen/pyinfraformat
Library can be installed also by `git clone` / downloading zip.
git clone https://github.com/ahartikainen/pyinfraformat
cd pyinfraformat
python -m pip install .
To install inplace for development work, use `-e` command.
python -m pip install -e .
## Quickstart
#### Basic usage
```python
import pyinfraformat as pif
pif.set_logger_level(50) # Suppress non-critical warnings, recommended for large files
holes = pif.from_infraformat("*.tek")
holes = holes.project("TM35FIN")
bounds = holes.bounds
holes.to_infraformat("holes_tm35fin.tek")
bounds = [6672242-200 , 385795-200, 6672242 +200, 385795+200]
gtk_holes = pif.from_gtk_wfs(bounds, "TM35Fin")
print(gtk_holes) # View holes object
#Infraformat Holes -object:
# Total of 203 holes
# - PO ......... 161
# - HP ......... 13
# - PA ......... 12
# - NO ......... 2
# - NE ......... 1
# - KE ......... 5
# - KR ......... 9
html_map = gtk_holes.plot_map()
html_map.save("soundings.html")
html_map # View map in jupyter
```

```python
hole_figure = gtk_holes[10].plot()
hole_figure # View hole in jupyter
```

#### Plot histograms from laboratory tests
```python
import pandas as pd
bounds = [6672242-2000 , 385795-2000, 6672242 +2000, 385795+2000]
gtk_holes = pif.from_gtk_wfs(bounds, "TM35FIN", maxholes=25_000)
laboratory_tests = gtk_holes.filter_holes(hole_type=["NO", "NE"], start="1990-01-01")
df = laboratory_tests.get_dataframe()
df['data_Soil type'] = df['data_Soil type'].astype("string")
clay_samples = df[df['data_Soil type'].str.endswith("Sa", na=False)].reset_index()
clay_samples['data_Laboratory w'] = pd.to_numeric(clay_samples['data_Laboratory w'])
fig = clay_samples['data_Laboratory w'].plot.hist(bins='fd')
fig.set_title("Clay samples water content, %")
fig
```

Raw data
{
"_id": null,
"home_page": null,
"name": "pyinfraformat",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "infraformat",
"author": "Ari Hartikainen, Taavi Dettenborn, Martti Hallipelto",
"author_email": null,
"download_url": null,
"platform": null,
"description": " [](https://github.com/ambv/black) [](https://codecov.io/gh/ahartikainen/pyinfraformat)\n\n\n# pyinfraformat\nPython library for reading, writing and analyzing Finnish borehole format Infraformat (version 2.5). \nWell suited for scientific and research applications.\n\n## Installation\n\nLatest (stable) `pyinfraformat` can be installed with pip\n\n python -m pip install pyinfraformat\n\nThe latest (unstable) version can be installed from git with pip (needs git-tools).\n\n python -m pip install git+https://github.com/ahartikainen/pyinfraformat\n\nLibrary can be installed also by `git clone` / downloading zip.\n\n git clone https://github.com/ahartikainen/pyinfraformat\n cd pyinfraformat\n python -m pip install .\n\nTo install inplace for development work, use `-e` command.\n\n python -m pip install -e .\n\n## Quickstart\n#### Basic usage\n```python\nimport pyinfraformat as pif\npif.set_logger_level(50) # Suppress non-critical warnings, recommended for large files\nholes = pif.from_infraformat(\"*.tek\")\nholes = holes.project(\"TM35FIN\")\nbounds = holes.bounds\nholes.to_infraformat(\"holes_tm35fin.tek\")\n\nbounds = [6672242-200 , 385795-200, 6672242 +200, 385795+200]\ngtk_holes = pif.from_gtk_wfs(bounds, \"TM35Fin\")\nprint(gtk_holes) # View holes object\n#Infraformat Holes -object:\n# Total of 203 holes\n# - PO ......... 161\n# - HP ......... 13\n# - PA ......... 12\n# - NO ......... 2\n# - NE ......... 1\n# - KE ......... 5\n# - KR ......... 9\n\n\nhtml_map = gtk_holes.plot_map()\nhtml_map.save(\"soundings.html\")\nhtml_map # View map in jupyter\n```\n\n\n```python\nhole_figure = gtk_holes[10].plot()\nhole_figure # View hole in jupyter\n```\n\n\n\n#### Plot histograms from laboratory tests\n```python\nimport pandas as pd\nbounds = [6672242-2000 , 385795-2000, 6672242 +2000, 385795+2000]\ngtk_holes = pif.from_gtk_wfs(bounds, \"TM35FIN\", maxholes=25_000)\nlaboratory_tests = gtk_holes.filter_holes(hole_type=[\"NO\", \"NE\"], start=\"1990-01-01\")\ndf = laboratory_tests.get_dataframe()\ndf['data_Soil type'] = df['data_Soil type'].astype(\"string\")\nclay_samples = df[df['data_Soil type'].str.endswith(\"Sa\", na=False)].reset_index()\nclay_samples['data_Laboratory w'] = pd.to_numeric(clay_samples['data_Laboratory w'])\nfig = clay_samples['data_Laboratory w'].plot.hist(bins='fd')\nfig.set_title(\"Clay samples water content, %\")\nfig\n```\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Python library for Finnish Infraformat",
"version": "25.7.10",
"project_urls": null,
"split_keywords": [
"infraformat"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "77deb19821524c6d4192f39b49aed88fb23df644db2ff55eed716392f722c37e",
"md5": "f794d4b9a3029e9a901e16ef06eeb252",
"sha256": "135ea8f16abc05e77ddf03a1f3644774c800d2de721db2c40b4231fa3a9fd033"
},
"downloads": -1,
"filename": "pyinfraformat-25.7.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f794d4b9a3029e9a901e16ef06eeb252",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 49584,
"upload_time": "2025-07-10T07:23:53",
"upload_time_iso_8601": "2025-07-10T07:23:53.022229Z",
"url": "https://files.pythonhosted.org/packages/77/de/b19821524c6d4192f39b49aed88fb23df644db2ff55eed716392f722c37e/pyinfraformat-25.7.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-10 07:23:53",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pyinfraformat"
}