[FLASH-USERS] Extraction of data from HDF5 files to python
Rambaks, Andris
andris.rambaks at rwth-aachen.de
Fri Jan 24 06:00:54 EST 2025
Hi Adrien,
I recently wrote Fortran code to save simulation data in the Chombo HDF5 format that is also used by FLASH. My approach was to work with legacy code I had lying around, hdf5 dump files and the visit Chombo plugin source code (https://github.com/visit-dav/visit/blob/develop/src/databases/Chombo/avtChomboFileFormat.C).
My suggestion is that you create an hdf5 dump file and just look at the group, attribute dataspace names to determine whether you can accomplish your goals with the data stored there. If not, you would have to write a custom output script. The Chombo plugin source code is also useful to look up hdf5 entity names.
Reading data from an HDF5 file is not that difficult - you have to use the HDF5 library (C, Fortran and Python versions exist), open the file and access the groups, attributes, dataspaces by name.
I found these course materials useful when starting with HDF5: https://www.fz-juelich.de/en/ias/jsc/education/training-courses/training-materials/course-material-parallel-i-o-and-portable-data-formats
I hope this helps!
Kind regards,
Andris Rambaks
________________________________
Von: flash-users <flash-users-bounces at flash.rochester.edu> im Auftrag von Adrien Da Ros <adrien.da-ros at u-bordeaux.fr>
Gesendet: Freitag, 24. Januar 2025 11:35:43
An: flash-users at flash.rochester.edu
Cc: Meirielen Caetano De Sousa
Betreff: [FLASH-USERS] Extraction of data from HDF5 files to python
Dear Flash users,
I am trying to extract some data from an .hdf file created with VisIt from FLASH simulations to use them with python.
A colleague of mine (Meirielen Caetano de Sousa at CELIA) is using it from a few months Flash and VisIt but we are still beginners.
The issue that I am encountering is that the meshgrid is adaptative during the whole simulation, and also non-uniform on the different axes.
In order to use correctly and efficiently the extracted data, I should need to recreate the meshgrid that is produced by Flash and to do so, I would need the accurate parameters that are stored in the .hdf file.
There are many variables that can be stored in the output files, such as 'block size', 'coordinates', or 'tele' (electron temperature).
My issue is that I do not know how to recreate the meshgrid (example given attached) with the variables I have access.
To explain more specifically my issue, the data array 'tele' that I want to use has a shape (294, 1, 16, 16).
The data array 'coordinates' of shape (294, 3) seems to give the location of a group of pixels of size (16, 16) according to the shape of 'tele' but the information about the size of the group, contained in 'block size' I suppose, is difficult to be used.
In the end, it is a puzzle that I do not have all the keys to finish.
Does it exist a specific python package that permits to use more easily such .hdf files ?
Do I have to use VisIt to save in a different format the data to properly use them with python ?
Do you have some documentation about how the data are plotted with VisIt ?
Thank you for your help.
With my sincere salutations,
Adrien Da Ros, PhD
Post-doctorant
CELIA - Université de Bordeaux
Mail: adrien.da-ros at u-bordeaux.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flash.rochester.edu/pipermail/flash-users/attachments/20250124/f73519fb/attachment.htm>
More information about the flash-users
mailing list