Python toolkit for decoding WITS (Wellsite Information Transfer Standard) data.
724 symbols across 20+ record types, auto-parsed from the spec. Decode WITS frames into validated Python objects, stream to SQL databases, and query time-series drilling data.
pip install witskitWith SQL storage:
pip install witskit[sql]Development:
git clone https://github.com/Critlist/witskit
cd witskit
pip install -e .from witskit import decode_frame
frame = """&&
01083650.40
01133.5
01142850.7
!!"""
result = decode_frame(frame)
for dp in result.data_points:
print(f"{dp.symbol_name}: {dp.parsed_value} {dp.unit}")Output:
DBTM: 3650.4 M
ROPA: 3.5 M/HR
HKLA: 2850.7 KDN
witskit demo # Run demo
witskit symbols --search "depth" # Search symbols
witskit decode sample.wits # Decode file
witskit decode sample.wits --fps # Use FPS units
witskit validate "&&\n01083650.40\n!!" # Validate frame
witskit convert 3650.4 M F # Convert unitsSQLite, PostgreSQL, and MySQL support for time-series drilling data:
from witskit.storage.sql_writer import SQLWriter, DatabaseConfig
config = DatabaseConfig.sqlite("drilling_data.db")
writer = SQLWriter(config)
await writer.initialize()
async for frame in stream_source:
await writer.store_frame(frame)
# Query with time filters
async for data_point in writer.query_data_points(
symbol_codes=["0108", "0113"],
start_time=datetime(2024, 1, 1),
limit=1000
):
print(f"{data_point.symbol_name}: {data_point.parsed_value}")See docs/sql_storage.md for details.
&&
01083650.40
01133.5
01142850.7
!!
Start delimiter (&&), data lines (4-digit code + value), end delimiter (!!).
| Record | Category | Symbols |
|---|---|---|
| 1 | Drilling (Time-Based) | 40 |
| 2 | Drilling (Depth-Based) | 26 |
| 8 | MWD/LWD Formation Eval | 46 |
| 15 | Cuttings/Lithology | 54 |
| 19 | Equipment Config | 89 |
20+ record types total. Records 5, 22-25 defined but not implemented.
witskit/
├── witskit/
│ ├── models/ # Symbol metadata, schemas
│ ├── decoder/ # Frame parsing
│ ├── transport/ # Serial, TCP, file readers
│ ├── storage/ # SQL backends
│ └── cli.py # Command-line interface
├── tests/ # Unit tests
├── docs/ # Documentation
└── examples/ # Example scripts
pytest tests/ -v
pytest tests/test_decoder.py -v- TCP connection tests fail with mocks but work with real data
- MySQL and PostgreSQL need additional testing, SQLite fully operational
- Serial communication untested
- Python 3.11+
- pydantic for validation
- typer for CLI
- rich for formatting
- pytest for testing
- SQLAlchemy for SQL storage
- asyncpg/aiomysql for async database drivers
- Symbol parser & decoder (done)
- Transport support (WIP)
- SQL storage with time-series analysis (done)
- WebSocket/MQTT real-time pipeline (planned)
- Web UI for monitoring (planned)
- Parquet export (planned)
MIT
Built by someone who got tired of mid-grade WITSML implementations. PRs welcome, especially if you've troubleshot WITS comms on standby waiting for the rig to pick up tools.