[Users] HDF5 Access coordinates corresponding to data

Haas, Roland rhaas at illinois.edu
Mon Sep 30 09:40:56 CDT 2019

Hello Kyle,

coordinates are not normally explicitly stored in hdf5 files.

However if you asked for output of the coordinates grid functions
(those defined in CartGrid3D) then you will have output files name like

x.file_0.h5 ...
y.file_0.h5 ...

and those datasets do indeed contain the coordinates (and the datasets
correspond to the datasets in vx.file_0.h etc.). See eg 


If you do not have the CartGrid3D files (they may be large after all
and change only rarely) then you can also construct coordinates (at
least Cartesian ones, this does not work for curvilinear coordinates
from Llama) using the attributes.

Each dataset (assuming you use the "standard" vertex centered mesh
refinement scheme and use no staggering) has attributes:


and the hdf5 shape of the dataset.

origin is the coordinate of the upper/left/front coordinate of the
grid patch that the dataset corresponds to (in order x,y,z) while delta
is the grid spacing (dx,dy,dz).

shape is the hdf5 shape of the patch in order z,y,z (since HDF5 wants C
ordering but Cactus normally uses Fortran ordering).

If you are using h5py then you can construct coordinates like so (I
hope I got the ordering all right, you may have to try a bit in case
the order should be x,y,z instead of z,y,z):

z,y,x = numpy.meshgrid(\


> Hello,
> I have vector data in the form of h5 files as such
> vx.file_0.h5   vy.file_0.h5   vz.file_0.h5
> vx.file_1.h5   vy.file_1.h5   vz.file_1.h5
> and so on. I am trying to use a python script to access the actual position
> of each data point so I can use it in a calculation but I'm not sure how to
> access it. I imagine it is buried somewhere in the attributes of each
> refinement level of the dataset, but I'm not sure where.
> Much appreciated,
> Kyle Nelli

My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from http://pgp.mit.edu .
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
Url : http://lists.einsteintoolkit.org/pipermail/users/attachments/20190930/2d07fb46/attachment-0001.bin 

More information about the Users mailing list