Parser for Texas RRC Well Bore dataset (EBCDIC)
Project description
py-rrc-wellbore
A professional-grade Python package for parsing the Texas Railroad Commission (RRC) Well Bore dataset (WBA091).
Problem Statement
Parsing 1980s-era Texas oil & gas data is a challenge. The data is often delivered in legacy EBCDIC Mainframe format with complex hierarchical structures. This package provides a robust solution to parse this data into modern, usable formats.
Hierarchical Data Structure
The RRC Well Bore dataset is hierarchical:
- Record Type '01': The Root record (API Number).
- Subsequent Record Types (02, 03, etc.): These records belong to the preceding '01' record until a new '01' record is encountered.
Installation
pip install py-rrc-wellbore
Usage
Basic Usage
Parse a local file (EBCDIC or Text) and iterate through wells:
from py_rrc_wellbore import WellBoreParser
parser = WellBoreParser()
# The parser automatically detects EBCDIC vs ASCII
for well in parser.parse_file("data/wba091.ebc"):
root = well['WBROOT'] # Key 01
print(f"API: {root['wb_api_number']}, Lease: {root['wb_lease_name']}")
# Access child segments (e.g., Completions - Key 02)
if 'WBCOMPL' in well:
completions = well['WBCOMPL']
# Child segments can be a list (multiple records) or a dict (single record)
if isinstance(completions, list):
for compl in completions:
print(f" - Completion Date: {compl.get('wb_compl_date')}")
else:
print(f" - Completion Date: {completions.get('wb_compl_date')}")
Filtering Segments
Optimize performance and output size by requesting only specific segments. You can use segment Keys (e.g., '01', '02') or Names.
# Parse only Root (01) and Casing (06) information
parser = WellBoreParser(segments_to_parse=['ROOT', 'WBCASE'])
for well in parser.parse_file("data/wba091.ebc"):
# well dictionary will only contain 'WBROOT' and 'WBCASE' keys
pass
Automatic Value Conversion
The raw data contains many encoded values (e.g., county, district codes). Use convert_values=True to automatically map these to human-readable descriptions.
parser = WellBoreParser(convert_values=True)
well = next(parser.parse_file("data/wba091.ebc"))
print(well['WBROOT']['wb_county_code'])
# Output: 'MIDLAND' (instead of '165')
Sample Data
The repository includes a sample.ebc file. This file is a small subset of the full Texas RRC Well Bore database, intended for testing and verification purposes. It contains binary EBCDIC data that the parser is capable of handling correctly.
Made with Gemini
This library was built with Gemini Pro 3, leveraging its advanced agentic capabilities to handle complex EBCDIC parsing and hierarchical data structures with minimal effort.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_rrc_wellbore-1.0.0.tar.gz.
File metadata
- Download URL: py_rrc_wellbore-1.0.0.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f04ee2be8a5eba30133a7ad427e6c37271eb11cdd0f9bf592f378408cacae156
|
|
| MD5 |
49aa8935a5164f0be46f1fd1aba733c5
|
|
| BLAKE2b-256 |
36a502bb870f9aa0d1ce449ec06ed5d65365efa40e97b316273e5ed9dad7626c
|
File details
Details for the file py_rrc_wellbore-1.0.0-py3-none-any.whl.
File metadata
- Download URL: py_rrc_wellbore-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
266380d84967dffed3b973ba0471f6266eced21d6023aeadd1a14d2814d670aa
|
|
| MD5 |
91f1d8a87130642d35e1cd82b9fc19b2
|
|
| BLAKE2b-256 |
5b2a4c224bb4d541671abea317d50dc524114590e567a7e3612bbecfd425cec8
|