Code Monkey home page Code Monkey logo

h5geo's Introduction

h5geo

C++ and python API to work with geo-data based on HDF5 containers through h5gt header only library.

For now h5geo provides API to work with:

  • seismic data
  • wells (deviations, logs, welltops)
  • maps
  • points
  • horizons

h5geo also includes h5geopy project wich is a python wrapper.

h5geopy uses pybind11 to make python bindings and there may be some perfomance penalty when copying matrices from C++ Eigen3 matrices to numpy (or std::vector to py::list). I have not done any perfomance testing.

This project is aimed at geoscientists and developers

Documentation

Common documentation: h5geo.readthedocs.io

C++ API documentation: tierra-colada.github.io/h5geo

Building h5geo with h5geopy support

h5geo depends on:

You can use superbuild or build every dependency by yourself. Then do:

mkdir build
cd build
cmake ..
  -DCMAKE_BUILD_TYPE=Release
  -DEigen3_ROOT:PATH=/path/to/eigen 
  -Dmagic_enum_ROOT:PATH=/path/to/magic_enum 
  -Dmio_ROOT:PATH=/path/to/mio
  -Dh5gt_ROOT:PATH=/path/to/h5gt 
  -DH5GEO_SUPERBUILD:BOOL=OFF
  -DH5GEO_USE_THREADS:BOOL=ON
  -DTBB_ROOT:PATH=/path/to/tbb
  -DH5GEO_BUILD_SHARED_LIBS:BOOL=ON
  -DH5GEO_BUILD_h5geopy:BOOL=ON
  -DHDF5_RUNTIME_DIR:PATH=/path/to/dir/containing/hdf5-runtime
  -DH5GEOPY_COPY_RUNTIME_DEPS:BOOL=ON
  -DPYTHON_EXECUTABLE=/path/to/python.exe 
  -DH5GEO_BUILD_TESTS:BOOL=OFF
  -DCMAKE_INSTALL_PREFIX:PATH=/install/prefix
  -G "some generator"
cmake --build . 

NOTE: instead of <prefix>_ROOT path (root directory of every package) you can pass <prefix>_DIR path containing some <prefix>-config.cmake file of every package.

NOTE: to run h5geopy python must know where HDF5-runtime, units-runtime, tbb-runtime and h5geo-runtime are located. You may choose whether to copy them to site-packages/h5geopy dir or add their dirs to PATH env. By default cmake try to search h5geo-runtime in h5geo-install/lib folder. Also h5geopy depends on h5gtpy. So you would need to have installed h5gtpy.

Installation h5geo with h5geopy

h5geo installation is done the same way one usually installs cmake project:

cmake --install . --prefix /some/path --config Release

Then you can find h5geopy in site-packages of your python env.

NOTE: cmake tries to find runtime dependencies at install step. If there are unresolved or conflict dependencies then you need to modify PATH env, rerun cmake .. and cmake --install . --prefix /some/path --config Release. You don't have to rebuild the project!

Build & Install using pip

It is possible to build and install the library using the following command:

pip install git+https://github.com/tierra-colada/[email protected] --verbose

This will automatically run CMake Superbuild to build build h5geo v0.1.0 and its dependencies (without GDAL support) in the site-pakages/h5geopy dir.

On modern PC this usually takes a couple of minutes.

NOTE: CMake and C++ compiler are needed.

Usage

Importing is done via:

from h5gtpy import h5gt
from h5geopy import h5geo

You can find tests in site-packages/h5geopy. To run them:

python -m unittest discover h5geopy.tests

Note: h5geopy (as well as h5geo) uses fortran memory order (columnwise). Thus you should allocate numpy with numpy.asfortranarray or order='F' as numpy uses C order by default.

Integrating with VS Code

There is stub file h5geopy/h5geo.pyi. You need to set VS Code setting "python.analysis.stubPath": "some/relative/path/to/stub-storage": where stub-storage is supposed to contain folder h5geopy with h5geo.pyi file.

I'm some kind of a uncomfortable to distribute stub file, so to be sure that stub file is updated you can generate your own stub file:

pip install pybind11-stubgen
pybind11-stubgen --no-setup-py h5geopy._h5geo

Integrating with PyCharm

You don't need to provide stub file to PyCharm as it handles this by its own.

Supported HDF5 versions

1.10, 1.12 (recommended)

Supported platforms

Windows 10/11, Linux, OSX

h5geo's People

Contributors

kerim371 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.