Skip to main content

Extract depth-labelled borehole images from PDF well log prints.

Project description

logprint_extractor

A Python package for extracting depth-labelled PNG strips from PDF borehole image log prints.

Each page of the PDF is cropped to the log track and saved as a PNG whose filename encodes the top and bottom depth of that strip — the format required for import into WellCAD as an RGB image.

Contact irene@cubicearth.nz for more information on extracting and using historic borehole image data.


Installation

pip install logprint_extractor

Requires Python ≥ 3.11. Dependencies (pymupdf, Pillow, matplotlib) are installed automatically.


Workflow

The extraction is a three-step process, each covered by a script in the tutorial/ folder.

Step 1 — Find pixel coordinates (tutorial/step1_find_pixel_range.py)

Use pxl_range() to interactively select the crop region on a rendered PDF page. Run this once for each distinct page layout (typically: first page, a representative middle page, and the last page).

  1. A matplotlib window opens showing the rendered page.
  2. Use the built-in zoom/pan tools to navigate to the area of interest.
  3. Toggle Selection Mode on, then click the top-left corner of the log strip.
  4. Press Accept Point to lock it in.
  5. Navigate to the bottom-right corner, click, then press Accept Point again.
  6. Close the window — the coordinate dict is printed to the terminal.
  7. Copy the coordinates into steps 2 and 3.

Step 2 — Verify the crop (tutorial/step2_inspect_image.py)

Use inspect_image() to display the cropped region for the first, a middle, and the last page. Confirm the crop looks correct before running the full extraction.

Step 3 — Extract images (tutorial/step3_extract_image.py)

Use extract_image() to batch-process all included pages. Each page is saved as a PNG named with its depth range, for example:

FORGE_78B-32 224.70 - 228.65.png

API reference

Function Description
pxl_range(pdf_path, page_num) Interactively define a crop rectangle and return pixel coordinates.
inspect_image(pdf_path, page_num, pixel_coords) Display a single cropped page region for verification.
extract_image(pdf_path, output_dir, wellname, top_depth, base_depth, ...) Batch-extract depth-labelled PNG strips from all included pages.

Tutorial data

The tutorial scripts use an open-access FMI log print from the Utah FORGE project:

McLennan, J. (2021). Utah FORGE: Well 78B-32 Daily Drilling Reports and Logs. [Data set]. Geothermal Data Repository. Energy and Geoscience Institute at the University of Utah. https://doi.org/10.15121/1814488

The PDF (University_Utah_FORGE_78B-32_FMI_Interpretation_20.pdf) can be downloaded from https://gdr.openei.org/submissions/1330.

Project details


Download files

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

Source Distribution

logprint_extractor-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

logprint_extractor-0.1.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file logprint_extractor-0.1.0.tar.gz.

File metadata

  • Download URL: logprint_extractor-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for logprint_extractor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 345702868ce924ab02095826fef4f5e638a80bb26407917d5d014f97219e2b33
MD5 ecb583d62fde40086aae0ca688acc5bc
BLAKE2b-256 9626a75ba09dedf8ec7842984e383d587c59822b386d7b4e0a1f17c0f627885a

See more details on using hashes here.

File details

Details for the file logprint_extractor-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for logprint_extractor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c5b097187478e3c0a3cf2c17a561fda3f1c4d3dcca3a552c71f8468dcd17b15
MD5 63ef7eb8c94091881dd94709fc4cfd0c
BLAKE2b-256 c23a1093b7be1338d2856b84f7f7bf62a58f9c64e5c3b46ed4531468ee65b006

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page