Metadata-Version: 2.4
Name: pymbc
Version: 1.5.1
Summary: A python package for working with MB Century downhole data.
Home-page: https://github.com/tricky67/pymbc
Author: Richard Williams
Author-email: rwilliams@mbcentury.com
Keywords: dab,csv,pts,htcc,Century Logger,las,parquet,hdf5
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Framework :: Matplotlib
Classifier: Environment :: No Input/Output (Daemon)
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Other Audience
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Text Processing
Classifier: Topic :: Scientific/Engineering
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=1.5
Requires-Dist: scipy>=1.13.0
Requires-Dist: lasio>=0.16
Provides-Extra: plot
Requires-Dist: matplotlib>=3.6; extra == "plot"
Provides-Extra: parquet
Requires-Dist: pyarrow>=15.0; extra == "parquet"
Provides-Extra: hdf5
Requires-Dist: h5py>=3.0; extra == "hdf5"
Provides-Extra: all
Requires-Dist: matplotlib>=3.6; extra == "all"
Requires-Dist: pyarrow>=15.0; extra == "all"
Requires-Dist: h5py>=3.0; extra == "all"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# MB Century Downhole Data Toolkit

https://www.mbcentury.com/services 

This toolkit provides easy access to data that has been exported from one of MB Century's data logging applications. It is primarily used to access downhole data that has been collected using MB Century's data collection systems.


## Example use

Use pip to install the package. Plotting, Parquet and HDF5 are optional extras
(`pymbc[plot]`, `pymbc[parquet]`, `pymbc[hdf5]`, or `pymbc[all]`).

```bash
pip install pymbc
```

## Example python code

Open a CSV file containing PTS data, plot it against depth and time, and convert it to Well Test Analysis format.
```python
import pymbc as mbc
from pathlib import Path

csvfile = Path(r'tests\_20230626_PTS__A.csv')
mb = mbc.MbcLog()
mb.ReadMbCsv(csvfile)
fnotes = csvfile.parent / (csvfile.stem + '_notes' + csvfile.suffix)
mb.ReadNotes(fnotes)
mb.CreatePassLogGuess()
plotdef = [mbc.PlotDefinition('TIMEDELTA', 'DEPTH', 'slategray', '-', False),
		   mbc.PlotDefinition('TIMEDELTA', 'PTS_PRES', 'royalblue', '-', False),
		   mbc.PlotDefinition('TIMEDELTA', 'PTS_FREQ', 'limegreen', '-', False),
		   mbc.PlotDefinition('TIMEDELTA', 'PTS_TEMP', 'tomato', '--', True)]
st,figt = mbc.PlotLog(mb, plotdef, title=mb.name, depthaxis=False)

plotdef = [mbc.PlotDefinition('DEPTH', 'TIMEDELTA', 'black', '-', False),
		   mbc.PlotDefinition('DEPTH', 'PTS_FREQ', 'limegreen', '--', True),
		   mbc.PlotDefinition('DEPTH', 'PTS_PRES', 'royalblue', '-', False),
		   mbc.PlotDefinition('DEPTH', 'PTS_TEMP', 'tomato', '-', True)]
sd,figd = mbc.PlotLog(mb, plotdef, title=mb.name, depthaxis=True) 
pts = mb.PtsWellTestAnalysis()
	
```      



# CHANGELOG

## Version 1.5.1 12/8/2026
- Added `MbcLog.passPrimary`, a `{pass_number: bool}` dict marking which passes
  are the ones to carry forward. A log often records an interval more than once
  — a down run and an up run, a repeat section — and only some are wanted for
  interpretation; this keeps that choice with the data rather than in whatever
  tool made it. Seeded `False` per pass beside `passNotes`, and stored in both
  Parquet and HDF5. A file written before 1.5.1 reads as none marked.

## Version 1.5.0 11/8/2026
- Sorted out run vs pass. A **run** is all the data recorded while the tool is
  in the well; a **pass** is one direction of travel, and several passes make up
  a run. The `RUNNO` column always held passes, so it is renamed `PASS`, and the
  methods with it: `CreateRunLogGuess`/`CreateRunLogNotes`/`PlotRunNo` become
  `CreatePassLogGuess`/`CreatePassLogNotes`/`PlotPassNo`, and `PlotLog`'s
  `plotRunNos` argument becomes `plotPasses`. **Breaking** - update calling code
  (the column name and these method names).
- Added per-pass notes: `MbcLog.passNotes`, a `{pass_number: text}` dict with an
  empty entry seeded per pass. Stored in both Parquet and HDF5 files.
- Added HDF5 read/write: `SaveToHdf5()`/`ReadHdf5()` via the optional
  `pip install pymbc[hdf5]`. A single self-describing file like Parquet, holding
  the data plus its units, header, per-pass notes and processing history, and
  lossless across the awkward dtypes (tz-aware timestamps, text, NaN gaps).
- `SaveToLas()`, `SaveToCsv()`, `WriteParquet()` and `SaveToHdf5()` take an
  optional `passes=` (a pass number or a list) to export a single pass or a
  chosen set; the default still writes every row.
- Fixed `PlotLog` hanging (and crashing the kernel) when `PASS` contained NaN:
  it drew a shaded span for every sample in the gaps between passes. It now
  treats each gap as one span.

## Version 1.4.0 2/8/2026
- Added WriteParquet()/ReadParquet(): a single self-describing file holding the
  data plus its units, header and processing history. Unlike SaveToCsv (which
  writes float_format='%.4f') the round trip is lossless - float64 values return
  bit-identical. Roughly 4x smaller than the equivalent CSV and much faster to
  read, especially for a subset of columns.
- matplotlib and pyarrow are now optional extras rather than hard requirements:
  `pip install pymbc[plot]` for PlotLog and CreateRunLogGuess(plot=True),
  `pip install pymbc[parquet]` for the Parquet functions, or `pymbc[all]`.
  Reading, converting and analysing log data needs neither. Existing installs
  are unaffected; a fresh install without an extra now skips those packages.

## Version 1.3.0 1/8/2026
- Added functioality to read LAS files

## Version 1.2.2 8/4/2026
- Fixed column renaming to properly convert old names to new ones.
- Added some default header items incase they are missing from import

## Version 1.2.1 28/1/2026
- Force units to be capital

## Version 1.2.0 27/1/2026
- Can resample data in time or depth
- Export to CSV, LAS and LINEWISE
- Fixes to handle some unusually formatted CSV files

## Version 1.1.4 21/10/2024
- Can work with open file streams.
- rounded TIMEDELTA and TIMESTAMPISO to 10us
- Changed encoding to ISO-8859-1 to avoid problems reading unicode in utf-8

## Version 1.1.3 13/09/2024
- Now works with TIMESTAMPISO when plotting vs. time.
- Updated sample data

## Version 1.1.2 29/07/2024
- Updated sample code in README.md

## Version 1.1.1 19/06/2024
- Improved CreateRunLogGuess method to split log in to multiple runs automatically.

## Version 1.1.0 12/06/2024
- Changed the column names to be consistant with industry norms.
- Added CreateRunLogGuess method to split log in to multiple runs automatically.

## Version 1.0.0 21/05/2024
- Released to PyPI
