Guidance needed on using #geometry_objects_read with HDF5 geometry

41 views
Skip to first unread message

Mehul Bagaria

unread,
Jan 7, 2026, 6:40:05 AMJan 7
to gprMax-users

Hello everyone,

I have been trying to use the #geometry_objects_read feature in gprMax
(https://docs.gprmax.com/en/latest/input.html#geometry-objects-read)
to build external geometry along with material property definitions and then load them directly into a simulation.

From the documentation, I understand that the geometry and material information should be provided in HDF5 format. However, I have not been able to find a clear description of the expected HDF5 file structure for this feature (datasets, naming conventions, dimensions, etc.).

Could anyone please:

  • share a working example HDF5 file, or

  • point me to any reference code, example repository, or documentation that explains how to generate the required HDF5 geometry/material file?

Any guidance on how this feature is typically used in practice would be greatly appreciated.

Thank you in advance for your help.

Perpolita

unread,
Apr 14, 2026, 5:49:47 AM (11 days ago) Apr 14
to gprMax-users
Hi, 
I'll try to help as much as I can. 
I personnaly use the #geometry_objects_read feature with geometry and material information created by me via another python code : this helps me making sure the files are working. 

First -> creating the files 
you have several options :

-> using a code where you create everything you want in your geometry (soils characteristics, thickness, etc)
then you use the feature gow = gprMax.GeometryObjectsWrite(p1=(0, 0, 0), p2=(x, y, z), filename=fn.with_suffix("").name) to save the geometry for future use
run the simulation with geometry_only=True to only get the geometry (and not running the whole code, taking much more time)
you'll then have a HDF5 (.h5) file and a material file (.txt) created automatically

-> other option: using the feature STLtoVoxel which allows you to create HDF5 file from a STL file
you'll then also have a HDF5 (.h5) file and a material file (.txt) created automatically 

There's probably other options but these two are the one I know and use. 

Then -> using the feature #geometry_objects_read
you'll need 2 files : the .h5 and the .txt (materials) and you just need to load them 
for example :

geofile = "geometry_file.h5"
matfile = "materials.txt"
geo = gprMax.GeometryObjectsRead(p1=(0, 0, 0), geofile=geofile, matfile=matfile)

then you add geo to the scene. 

Please notice that I am using de gprMax-devel version and I think you are using another version. I shared with you are .h5 that is working for me but I don't know if it'll work for you. 
creating_geometry.py is the file used to create the geometry and obtaining creating_geometry.h5 and creating_geometry_materials.txt
using_geometry.py is the file where I load the obtaining create_geometry.h5 and creating_geometry_materials.txt

I hope this message is helpful. I'll explain again if you don't understand something. 
using_geometry.py
creating_geometry_materials.txt
creating_geometry.zip
creating_geometry.py
Reply all
Reply to author
Forward
0 new messages