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.1.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.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: logprint_extractor-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 bdddc0b83858bcf51e443377d359d389bc95e8294faeaefca1bcf09206963b4b
MD5 66488f6eade93b3020a6dab679fa0f7d
BLAKE2b-256 f7be9340579abfae3811113b83c319fb7e7e2e0256a88df438482558c0384f33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for logprint_extractor-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 00ffd10a4701c650a6c77dfef11cb1af3548d0fd58cb58a178905de2435fc21c
MD5 a9ace1207787637df4f0f81dff7a669a
BLAKE2b-256 593495e6fb6b2fc55c821a89a5758f3c0496f7c8fd9fdd7a73f639e350405307

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