Skip to main content

A Python library for converting geoh5py objects to PyVista data objects for 3D visualization and geometry processing.

Project description

geoh5vista: a Geoh5 <> PyVista (VTK) interface

A PyVista (and VTK) interface for the Geoh5 file format providing Python 3D visualization and useable data structures for processing datasets in the geoh5 specification. This library allows geologists to access the powerful tools available in the PyVista ecosystem for their data stored in the Geoh5 format.

The structure and interfaces of this project are heavily inspired by the 'omfvista' package, which provides a similar interface for the 'omf' format.

omfvista package: https://github.com/OpenGeoVis/omfvista

Geoh5 Python interface package: https://mirageoscience-geoh5py.readthedocs-hosted.com/en/stable/index.html

Documentation is hosted at https://github.com/derek-kinakin/geoh5vista

Installation

From PyPi (coming soon)

pip install geoh5vista

From Github

pip install git+https://github.com/derek-kinakin/geoh5vista.git

Current Status of Supported Geoh5 Entities

This table provides the list of supported entities. Read from and write to Geoh5 support is the goal for each entity.

Geoh5 Entity PyVista Object Read from Geoh5 Write to Geoh5 Notes
Workspace MultiBlock Yes Yes A multiblock containing several object can be written to Geoh5
Points PointSet Yes Yes
Curve PolyData Yes Yes
Surface PolyData Yes Yes
2D Grid ImageData Yes Yes 2D grid with dimensions nU x nV x 1
Block model ImageData or StructuredGrid Yes Yes 3D grid with dimensions nU x nV x nZ
Drillholes PolyData Yes No Drillholes can be round-tripped back to geoh5 as curves
Slicer PolyData Yes No Geometry available as object metadata

Example Use

import pyvista as pv
import geoh5vista

project = geoh5vista.read_geoh5('test_file.geoh5')
project

Once the data is loaded as a pyvista.MultiBlock dataset from geoh5vista, that object can be directly used for interactive 3D visualization from PyVista:

An interactive scene can be created and manipulated to create a figure. First, grab the elements from the project:

# Grab a few elements of interest and plot em up!
vol = project["Block Model"]
topo = project["Topography"]
dacite = project["Dacite"]

Then create a 3D scene with these spatial data and apply a filtering tool from PyVista to the volumetric data:

# Create a plotting window
p = pv.Plotter(notebook=False)
# Add our datasets
p.add_mesh(topo, cmap="gist_earth", opacity=0.5)
p.add_mesh(dacite, color=dacite["gh5_colour"], opacity=0.6)
# Add the volumetric dataset with a thresholding tool
p.add_mesh_threshold(vol)
# Add the bounds axis
p.show_bounds()
# Render the scene in a pop out window
p.show()

Writing PyVista objects to a Geoh5 file can be as simple as:

# Write a single object to geoh5
geoh5vista.write_geoh5(topo, "new_gh5_topo_file.geoh5")

# Write a multiblock to geoh5
new_project = pv.MultiBlock()
new_project["Topo"] = topo
new_project["Dacite"] = dacite

geoh5vista.write_geoh5(new_project, "new_project.geoh5")

Project details


Release history Release notifications | RSS feed

This version

0.2

Download files

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

Source Distribution

geoh5vista-0.2.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

geoh5vista-0.2-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file geoh5vista-0.2.tar.gz.

File metadata

  • Download URL: geoh5vista-0.2.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.12.3"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.3","system":{"name":"Windows","release":"11"}} HTTPX2/2.3.0

File hashes

Hashes for geoh5vista-0.2.tar.gz
Algorithm Hash digest
SHA256 8ad1bd59689d208ce16c3eb848fc6d531fedf83ffe359a2e7bcd40e715e1a8e0
MD5 4a535647d1c3b27117b009b95bece7e3
BLAKE2b-256 f7661893f104fe361eda47177655d89e9ffb97f1414082427cb7d665ede61d9f

See more details on using hashes here.

File details

Details for the file geoh5vista-0.2-py3-none-any.whl.

File metadata

  • Download URL: geoh5vista-0.2-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.12.3"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.3","system":{"name":"Windows","release":"11"}} HTTPX2/2.3.0

File hashes

Hashes for geoh5vista-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 88849a89e75057ee22e66c7879437e66e11440fdad34003418b691357541f634
MD5 c8ccfb2512d91cd7cc05e72c666aaad2
BLAKE2b-256 0014cc6872616acc8d6a27169b4cd934b20c387bbe5a67a557d74512fbf0ae17

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