{"id":27798,"library":"geoh5py","title":"geoh5py - Python API for geoh5 file format","description":"geoh5py is a Python library providing a high-level interface to read, write, and manipulate geoh5, an open file format for geoscientific data. It supports various geoscience objects like points, curves, surfaces, grids, drillholes, and 3D block models. Version 0.12.1 supports Python >=3.10,<4.0, and is actively maintained by Mira Geoscience with regular releases (approx. monthly).","status":"active","version":"0.12.1","language":"python","source_language":"en","source_url":"https://github.com/MiraGeoscience/geoh5py","tags":["geoscience","file-format","hdf5","data-management","3d-data"],"install":[{"cmd":"pip install geoh5py","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core dependency for array operations","package":"numpy","optional":false},{"reason":"Required for HDF5 file I/O underlying geoh5 format","package":"h5py","optional":false},{"reason":"Used for data validation and settings management","package":"pydantic","optional":false},{"reason":"Optional but used for tabular data handling if available","package":"pandas","optional":true}],"imports":[{"note":"Workspace is in the workspace module, not top-level.","wrong":"from geoh5py import Workspace","symbol":"Workspace","correct":"from geoh5py.workspace import Workspace"},{"note":"Object types are in the objects module.","wrong":"from geoh5py import PointData","symbol":"PointData","correct":"from geoh5py.objects import PointData"},{"note":"","wrong":"","symbol":"Grid2D","correct":"from geoh5py.objects import Grid2D"}],"quickstart":{"code":"from geoh5py.workspace import Workspace\n\n# Create a new workspace\nworkspace = Workspace('example.geoh5')\n\n# Add a point data object\nfrom geoh5py.objects import PointData\nimport numpy as np\n\npts = PointData.create(workspace,\n                       vertices=np.array([[0,0,0],[1,0,0],[0,1,0]]))\n\n# Add data to points\npts.add_data({'elevation': {'values': np.array([100,200,300])}})\n\n# Close workspace\nworkspace.close()","lang":"python","description":"Creates a geoh5 workspace, adds a PointData object with vertices and a data attribute, then closes."},"warnings":[{"fix":"Upgrade Python to 3.10+ or use geoh5py 0.9.2 (last supporting Python 3.9).","message":"Python 3.9 or earlier is not supported. Requires Python >=3.10.","severity":"breaking","affected_versions":"<0.10.0"},{"fix":"Always access data by name, e.g., obj.get_data('my_data'), not by index.","message":"The 'get_data' method on objects returns a dict with keys as data names; in older versions it returned lists. Relying on order may break.","severity":"deprecated","affected_versions":""},{"fix":"Use 'with Workspace('file.geoh5') as workspace:' or call workspace.close() after operations.","message":"Workspace files must be closed properly (via .close() or context manager). Otherwise, data may be lost or file locked.","severity":"gotcha","affected_versions":"all"},{"fix":"Manually convert BGR to RGB when using colour values.","message":"Colour data in VisualParameters returns BGR order, not RGB. This can cause unexpected colour rendering.","severity":"gotcha","affected_versions":"<=0.12.1"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use 'from geoh5py.workspace import Workspace'.","cause":"Attempting to import Workspace from top-level geoh5py instead of geoh5py.workspace.","error":"AttributeError: module 'geoh5py' has no attribute 'Workspace'"},{"fix":"For creation, ensure the file path is writable; for reading, check the file exists.","cause":"When opening a workspace for reading, the file must exist. Creating with 'Workspace('new.geoh5')' requires write mode.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'example.geoh5'"},{"fix":"Close the geoh5 file in any other application before opening with geoh5py.","cause":"The file is locked by another process (e.g., geoh5 GUI).","error":"OSError: Unable to open file (unable to open file: name = '...', errno = 13, error message = 'Permission denied', flags = 0, o_flags = 0)"},{"fix":"Ensure the length of data values equals the number of base elements (e.g., vertices for PointData).","cause":"Adding data with mismatched array length relative to object vertices or cells.","error":"ValueError: Data values length does not match number of vertices"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}