# Error reading hdf5 vector from xdmf

**URL:** https://discourse.paraview.org/t/error-reading-hdf5-vector-from-xdmf/9918
**Category:** ParaView Support
**Created:** [June 27, 2022, 9:06am UTC](https://discourse.paraview.org/t/error-reading-hdf5-vector-from-xdmf/9918 "2022-06-27T09:06:26Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![loicg](https://discourse.paraview.org/user_avatar/discourse.paraview.org/loicg/32/9541_2.png) [@loicg](https://discourse.paraview.org/u/loicg)
#### Post date: [June 27, 2022, 9:06am UTC](https://discourse.paraview.org/t/error-reading-hdf5-vector-from-xdmf/9918/1 "2022-06-27T09:06:26Z")

</div>

Hello,  
I try to read a vector field on a 2DCoRectMesh. If I use an XML format for the data, I am able to open the xdmf file into paraview.  
But if I try to do the same with the data in an h5 file, paraview said: “Failed to read attribute data”.  
I don’t understand what happens here.

The files are available here:

> <https://gist.github.com/gouarin/34ae5f3561c3585e97908b7a5af6fb07>

Any idea?

Thanks,  
Loic

---

<div class="post-metadata">

### Author: ![Joachim\_P](https://discourse.paraview.org/user_avatar/discourse.paraview.org/joachim_p/32/9596_2.png) [@Joachim\_P](https://discourse.paraview.org/u/Joachim_P)
#### Post date: [July 8, 2022, 11:38am UTC](https://discourse.paraview.org/t/error-reading-hdf5-vector-from-xdmf/9918/2 "2022-07-08T11:38:47Z")

</div>

Loic,  
HDF5 files are raw data/arrays containers. ParaView does not provide a generic reader to read those files and arrays without attaching them to a format (like Visit) or XML schema (like XDMF) that describes how to use the h5 raw data to create datasets (points, cells, attributes).  
HTH

---

<div class="post-metadata">

### Author: ![loicg](https://discourse.paraview.org/user_avatar/discourse.paraview.org/loicg/32/9541_2.png) [@loicg](https://discourse.paraview.org/u/loicg)
#### Post date: [July 8, 2022, 11:41am UTC](https://discourse.paraview.org/t/error-reading-hdf5-vector-from-xdmf/9918/3 "2022-07-08T11:41:40Z")

</div>

Thanks Joachim for your reply.  
I know that paraview can’t read hdf5 file and this is why I also have provided the xdmf files.

---

<div class="post-metadata">

### Author: ![Joachim\_P](https://discourse.paraview.org/user_avatar/discourse.paraview.org/joachim_p/32/9596_2.png) [@Joachim\_P](https://discourse.paraview.org/u/Joachim_P)
#### Post date: [July 8, 2022, 12:03pm UTC](https://discourse.paraview.org/t/error-reading-hdf5-vector-from-xdmf/9918/4 "2022-07-08T12:03:37Z")

</div>

Sorry Loic, I got it wrong. So yeah, the XDMF reader fails to read the array from the H5 file. I will take a look and let you know.

---

<div class="post-metadata">

### Author: ![Joachim\_P](https://discourse.paraview.org/user_avatar/discourse.paraview.org/joachim_p/32/9596_2.png) [@Joachim\_P](https://discourse.paraview.org/u/Joachim_P)
#### Post date: [July 8, 2022, 12:30pm UTC](https://discourse.paraview.org/t/error-reading-hdf5-vector-from-xdmf/9918/5 "2022-07-08T12:30:35Z")

</div>

Loic,  
The issue is related to this “bug fix”: [https://gitlab.kitware.com/vtk/vtk/-/commit/d4b9c45476042db181f553c388421be5e75fd63d](https://gitlab.kitware.com/vtk/vtk/-/commit/d4b9c45476042db181f553c388421be5e75fd63d)  
Without this patch that has been merged into ParaView, the loading process runs perfectly.  
The issue is due to `count[2] += 1;` which ends up to request a 4,4,3 array instead of a 4,4,2 one.

Maybe @Dave_DeMarle remembers on which cases the ternary test introduced a bug?

Cheers,  
Joachim

---

<div class="post-metadata">

### Author: ![Dave\_DeMarle](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dave_demarle/32/27_2.png) [@Dave\_DeMarle](https://discourse.paraview.org/u/Dave_DeMarle)
#### Post date: [July 8, 2022, 1:38pm UTC](https://discourse.paraview.org/t/error-reading-hdf5-vector-from-xdmf/9918/6 "2022-07-08T13:38:23Z")

</div>

No I don’t but the bug tracker lead me to this.  
[[Paraview] ParaView5.1.0 fails to read XDMF 3DCoRectMesh - Sonja Habbinga - org.paraview.paraview - MarkMail](https://markmail.org/thread/by4igvhjdnt7nc32#query:+page:1+mid:by4igvhjdnt7nc32+state:results)

---

<div class="post-metadata">

### Author: ![Joachim\_P](https://discourse.paraview.org/user_avatar/discourse.paraview.org/joachim_p/32/9596_2.png) [@Joachim\_P](https://discourse.paraview.org/u/Joachim_P)
#### Post date: [July 8, 2022, 10:41pm UTC](https://discourse.paraview.org/t/error-reading-hdf5-vector-from-xdmf/9918/7 "2022-07-08T22:41:55Z")

</div>

Thanks @Dave_DeMarle , I can still reproduce the issue if we go back to the ternary test with the dataset of this old thread.  
That said, something like  
` count[2] += ((update_extents[1] - update_extents[0]) > 0 || count[2] == 0 )? 1 : 0;`  
does the trick for both files but I cannot ensure it is an absolute correct solution.

Cheers,  
j.

---

<div class="post-metadata">

### Author: ![loicg](https://discourse.paraview.org/user_avatar/discourse.paraview.org/loicg/32/9541_2.png) [@loicg](https://discourse.paraview.org/u/loicg)
#### Post date: [July 9, 2022, 6:10am UTC](https://discourse.paraview.org/t/error-reading-hdf5-vector-from-xdmf/9918/8 "2022-07-09T06:10:09Z")

</div>

Thanks @Joachim_P for your investigation.
