Skip to main content

Small Python library to manipulate BOR files

Installation

Requirements:
  • python >= 3.8

You can install, upgrade, uninstall borfile with these commands:

$ pip install borfile

To add support of exporting data to other formats (such as .zarr, .parquet or .xml):

$ pip install borfile[extra]

Using a virtualenv may help overcome issues between python and your distribution.

Usage

>>> import borfile
>>> bor = borfile.read('./tests/data/parameters/DRILL/50000240718143044D/50000240718143044D.bor')
>>> bor.domain
'DRILLING PARAMETERS'
>>> bor.description['borehole_ref']
'TEST HOLE 1'

>>> bor.description['drilling']['method']
'DRLMTD_RTR'

BOR data can be used and edited as a pandas DataFrame

>>> import pandas
>>> pandas.set_option('display.precision', 2)
>>>
>>> bor.data
        DEPTH     AS  EVP  EVR     TP    IP     TQ   HP
time
0.0      7.71   0.00    0    0  53.20  0.00  41.60  0.0
2.8      7.72  15.23    0    0  51.67  8.64  30.01  0.0
4.0      7.73  33.78    0    0  51.67  5.90  32.45  0.0
5.4      7.74  26.06    0    0  51.98  0.40  20.85  0.0
8.0      7.75  14.03    0    0  51.98  0.00  20.85  0.0
...       ...    ...  ...  ...    ...   ...    ...  ...
5211.2  19.95  16.58    0    0  55.34  8.03  33.06  0.1
5214.0  19.96  13.03    0    0  55.03  0.10  25.12  0.1
5219.4  19.97   6.76    0    0  55.34  0.00  33.97  0.1
5224.4  19.98   7.30    0    0  54.42  0.10  28.17  0.1
5233.8  20.00   7.30    0    0  55.34  0.00  35.19  0.0

[1203 rows x 8 columns]
>>> bor.data.describe()
         DEPTH       AS     EVP       EVR       TP       IP       TQ       HP
count  1203.00  1203.00  1203.0  1.20e+03  1203.00  1203.00  1203.00  1203.00
mean     13.86    14.53     0.0  5.82e-03    53.30     5.30    31.07     0.05
std       3.55    14.40     0.0  7.61e-02     1.53     7.83     7.54     0.09
min       7.71     0.00     0.0  0.00e+00    47.40     0.00     8.03     0.00
25%      10.78     9.12     0.0  0.00e+00    52.28     0.00    26.34     0.00
50%      13.89    11.40     0.0  0.00e+00    53.81     0.71    30.31     0.00
75%      16.94    15.20     0.0  0.00e+00    54.42     8.34    34.89     0.10
max      20.00   182.43     0.0  1.00e+00    55.95    37.02    77.31     2.23
>>> bor.data.loc[:1]
      DEPTH   AS  EVP  EVR    TP   IP    TQ   HP
time
0.0    7.71  0.0    0    0  53.2  0.0  41.6  0.0
>>> bor.data.loc[0, 'DEPTH'] = 7
>>> bor.data.loc[:1]
      DEPTH   AS  EVP  EVR    TP   IP    TQ   HP
time
0.0     7.0  0.0    0    0  53.2  0.0  41.6  0.0
>>> import matplotlib.pyplot as plt
>>> bor.data.set_index('DEPTH').plot.area(figsize=(16, 6), y=['AS', 'TP'], subplots=True)
docs/figure-example.png

You can export the data in any format supported by the pandas DataFrame class

>>> bor.to_csv('/tmp/data.csv')
>>> bor.to_json('/tmp/data.json')
>>> bor.to_zarr('/tmp/data.zarr', mode='w')  # need pip install borfile[extra]
>>> bor.to_xml('/tmp/data.xml')  # need pip install borfile[extra]
>>> bor.to_parquet('/tmp/data.parquet')  # need pip install borfile[extra]

Changes can be made persistent with the save method..

>>> bor.save()

..or discarded with the reset method

>>> bor.reset()

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

borfile-0.3.0.tar.gz (437.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

borfile-0.3.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file borfile-0.3.0.tar.gz.

File metadata

  • Download URL: borfile-0.3.0.tar.gz
  • Upload date:
  • Size: 437.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.33.1

File hashes

Hashes for borfile-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a8430185484e9bbb7775005e89781734aa4afcbdeded34c41b9265c17e0acfa0
MD5 d74d86416d78e41102a80371d9dace57
BLAKE2b-256 7a77bbf9e40e7527def98967d97774e44a8e2f3ddfd01d4956ff50897820f3ba

See more details on using hashes here.

File details

Details for the file borfile-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: borfile-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.33.1

File hashes

Hashes for borfile-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 073bdac0adb23634a9e0371ed0d2553bb2504cb3b757151d906251e087f8696b
MD5 3e19ca49f51fa470872b33c935024026
BLAKE2b-256 feadc0be8f26345a9c1cc37bc51a2f9c6eef15871bdd195e9d263da737c158ab

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page