# How to include a time series in a vtkhdf file?

**URL:** https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430
**Category:** Support
**Created:** [May 10, 2023, 7:58pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430 "2023-05-10T19:58:53Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![lucasbanting](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasbanting/32/7048_2.png) [@lucasbanting](https://discourse.vtk.org/u/lucasbanting)
#### Post date: [May 10, 2023, 7:58pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/1 "2023-05-10T19:58:53Z")

</div>

I am attempting to use the VTKHDF format to store time series data of an unstructured grid.

So far I have been able to save single timesteps into the hdf file and load them into paraview, but I can’t find any documentation on how to include timeseries data in the hdf file.

I assume it is possible, due to this previous question: [Transient vtkHDFReader off by a step](https://discourse.vtk.org/t/transient-vtkhdfreader-off-by-a-step/11332)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [May 11, 2023, 7:38am UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/2 "2023-05-11T07:38:06Z")

</div>

@jfausty @danlipsa

---

<div class="post-metadata">

### Author: ![jfausty](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jfausty/32/5372_2.png) [@jfausty](https://discourse.vtk.org/u/jfausty)
#### Post date: [May 11, 2023, 7:48am UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/3 "2023-05-11T07:48:26Z")

</div>

Hi @lucasbanting,

This is a brand new feature that was just integrated in this merge request: [https://gitlab.kitware.com/vtk/vtk/-/merge\_requests/10094](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/10094).

The formal reader documentation is forthcoming and we have not yet had the time to put publish it. I’ll be sure to update this thread when it is. Navigating to the merge request linked above, you should be able to find a good deal of information regarding how time is formatted.

Here is also a test data set that you can use for inspiration:  
[transient\_sphere.hdf](https://discourse.vtk.org/uploads/short-url/gBHzeeObHytObeKJ8uJpOv4rJbv.hdf) (82.3 KB)

Hope that helps!

Best regards,

Julien

---

<div class="post-metadata">

### Author: ![logantm2](https://discourse.vtk.org/user_avatar/discourse.vtk.org/logantm2/32/7009_2.png) [@logantm2](https://discourse.vtk.org/u/logantm2)
#### Post date: [May 11, 2023, 2:01pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/4 "2023-05-11T14:01:08Z")

</div>

Also worth mentioning that you can still use paraview to visualize transient vtkhdf files, but I don’t believe that this MR has made it through to an official release yet, so you’ll need a recent nightly build.

---

<div class="post-metadata">

### Author: ![lucasbanting](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasbanting/32/7048_2.png) [@lucasbanting](https://discourse.vtk.org/u/lucasbanting)
#### Post date: [May 11, 2023, 3:16pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/5 "2023-05-11T15:16:52Z")

</div>

What should I use for the offsets when I want to use the same geometry for all time steps?

This is what I tried (I only have CellData):

```auto
# offsets that are just all zeros
Steps["PartOffsets"] = zeros(Int64, NSteps)
Steps["PointOffsets"] = zeros(Int64, NSteps)
Steps["CellOffsets"] = zeros(Int64, 1, NSteps)
Steps["ConnectivityIdOffsets"] = zeros(Int64, 1, NSteps,)

```

Here is my h5dump:

```auto
HDF5 "time_series.hdf" {
GROUP "/" {
   GROUP "VTKHDF" {
      ATTRIBUTE "Type" {
         DATATYPE H5T_STRING {
            STRSIZE 16;
            STRPAD H5T_STR_NULLTERM;
            CSET H5T_CSET_ASCII;
            CTYPE H5T_C_S1;
         }
         DATASPACE SCALAR
         DATA {
         (0): "UnstructuredGrid"
         }
      }
      ATTRIBUTE "Version" {
         DATATYPE H5T_STD_I64LE
         DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
         DATA {
         (0): 2, 0
         }
      }
      GROUP "CellData" {
         DATASET "E" {
            DATATYPE H5T_IEEE_F64LE
            DATASPACE SIMPLE { ( 20514816, 3 ) / ( 20514816, 3 ) }
         }
      }
      DATASET "Connectivity" {
         DATATYPE H5T_STD_I64LE
         DATASPACE SIMPLE { ( 213696 ) / ( 213696 ) }
      }
      DATASET "NumberOfCells" {
         DATATYPE H5T_STD_I64LE
         DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
      }
      DATASET "NumberOfConnectivityIds" {
         DATATYPE H5T_STD_I64LE
         DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
      }
      DATASET "NumberOfPoints" {
         DATATYPE H5T_STD_I64LE
         DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
      }
      DATASET "Offsets" {
         DATATYPE H5T_STD_I64LE
         DATASPACE SIMPLE { ( 71233 ) / ( 71233 ) }
      }
      DATASET "Points" {
         DATATYPE H5T_IEEE_F64LE
         DATASPACE SIMPLE { ( 80136, 3 ) / ( 80136, 3 ) }
      }
      GROUP "Steps" {
         ATTRIBUTE "NSteps" {
            DATATYPE H5T_STD_I64LE
            DATASPACE SCALAR
            DATA {
            (0): 288
            }
         }
         GROUP "CellDataOffsets" {
            DATASET "E" {
               DATATYPE H5T_STD_I64LE
               DATASPACE SIMPLE { ( 288 ) / ( 288 ) }
            }
         }
         DATASET "CellOffsets" {
            DATATYPE H5T_STD_I64LE
            DATASPACE SIMPLE { ( 288, 1 ) / ( 288, 1 ) }
         }
         DATASET "ConnectivityIdOffsets" {
            DATATYPE H5T_STD_I64LE
            DATASPACE SIMPLE { ( 288, 1 ) / ( 288, 1 ) }
         }
         DATASET "PartOffsets" {
            DATATYPE H5T_STD_I64LE
            DATASPACE SIMPLE { ( 288 ) / ( 288 ) }
         }
         DATASET "PointOffsets" {
            DATATYPE H5T_STD_I64LE
            DATASPACE SIMPLE { ( 288 ) / ( 288 ) }
         }
         DATASET "Values" {
            DATATYPE H5T_IEEE_F64LE
            DATASPACE SIMPLE { ( 288 ) / ( 288 ) }
         }
      }
      DATASET "Types" {
         DATATYPE H5T_STD_U8LE
         DATASPACE SIMPLE { ( 71232 ) / ( 71232 ) }
      }
   }
}
}

```

All my offsets are zeros, except for CellDataOffsets.

---

<div class="post-metadata">

### Author: ![Jens\_Munk\_Hansen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jens_munk_hansen/32/1215_2.png) [@Jens\_Munk\_Hansen](https://discourse.vtk.org/u/Jens_Munk_Hansen)
#### Post date: [May 11, 2023, 8:12pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/6 "2023-05-11T20:12:37Z")

</div>

There is a pretty cool example of this made by @berk.geveci for teaching how temporal streaming works. This one of the best resources that I have found about temporal streaming. [https://www.kitware.com/developing-hdf5-readers-using-vtkpythonalgorithm/](https://www.kitware.com/developing-hdf5-readers-using-vtkpythonalgorithm/)

---

<div class="post-metadata">

### Author: ![lucasbanting](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasbanting/32/7048_2.png) [@lucasbanting](https://discourse.vtk.org/u/lucasbanting)
#### Post date: [May 13, 2023, 2:37pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/7 "2023-05-13T14:37:20Z")

</div>

@jfausty Hi Julien, any idea what this error messae implies when trying to load my hdf file?

```auto
ERROR: In vtkExecutive.cxx, line 742
vtkPVCompositeDataPipeline (000001998065FBD0): Algorithm vtkFileSeriesReader (000001998050B010) returned failure for request: vtkInformation (0000019992E723F0)
  Debug: Off
  Modified Time: 524470
  Reference Count: 1
  Registered Events: (none)
  Request: REQUEST_DATA
  FORWARD_DIRECTION: 0
  ALGORITHM_AFTER_FORWARD: 1
  FROM_OUTPUT_PORT: 0

```

---

<div class="post-metadata">

### Author: ![jfausty](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jfausty/32/5372_2.png) [@jfausty](https://discourse.vtk.org/u/jfausty)
#### Post date: [May 15, 2023, 7:23am UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/8 "2023-05-15T07:23:43Z")

</div>

Hi @lucasbanting,

As is, the excerpt is a little cryptic. It is odd that you are using the `vtkFileSeriesReader`. Transient `vtkHDF` shouldn’t be in more than one file.

Can you share the steps to reproduce with the data ?

Best regards,  
Julien

---

<div class="post-metadata">

### Author: ![lucasbanting](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasbanting/32/7048_2.png) [@lucasbanting](https://discourse.vtk.org/u/lucasbanting)
#### Post date: [May 15, 2023, 2:53pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/9 "2023-05-15T14:53:56Z")

</div>

Starting from a working VTKHDF unstructured grid file, I added:

1. A ‘Steps’ group under group ‘VTKHDF’.
2. The attribute ‘NSteps’ to the ‘Steps’ group.
3. Dataset ‘Values’ (NSteps,) to ‘Steps’ group.
4. Dataset ‘PartOffsets’ (NSteps,) to ‘Steps’ group.
5. Dataset ‘PointOffsets’ (NSteps,) to ‘Steps’ group.
6. Dataset ‘CellOffsets’ (NSteps,1) to ‘Steps’ group.
7. Dataset ‘ConnectivityIdOffsets’ (NSteps,1) to ‘Steps’ group.
8. Add Dataset ‘CellDataOffsets’ (NSteps,) to ‘Steps’ group.

For testing, I made all my offsets all zeros just to see if the file would load.  
When loading into paraview, I can see the actual time steps in the top bar, but can’t view anything.  
I can share my hdf file with you if you’d find it useful.

---

<div class="post-metadata">

### Author: ![lucasbanting](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasbanting/32/7048_2.png) [@lucasbanting](https://discourse.vtk.org/u/lucasbanting)
#### Post date: [May 17, 2023, 12:48pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/10 "2023-05-17T12:48:55Z")

</div>

Do you have a working example with CellData?

---

<div class="post-metadata">

### Author: ![jfausty](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jfausty/32/5372_2.png) [@jfausty](https://discourse.vtk.org/u/jfausty)
#### Post date: [May 17, 2023, 12:54pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/11 "2023-05-17T12:54:54Z")

</div>

Hi @lucasbanting,

What ParaView/VTK version are you using?

ParaView `v5.11` and VTK’s release won’t have support for transient data as it is a relatively recent feature. If you are using prebuilt ParaView binaries downloaded off the Kitware website I would advise you to use the `nightly` packages which are built every day from the ` master` branch.

Best regards,  
Julien

---

<div class="post-metadata">

### Author: ![lucasbanting](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasbanting/32/7048_2.png) [@lucasbanting](https://discourse.vtk.org/u/lucasbanting)
#### Post date: [May 17, 2023, 12:55pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/12 "2023-05-17T12:55:55Z")

</div>

I am using 5.11.1-1124 from the website.

---

<div class="post-metadata">

### Author: ![jfausty](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jfausty/32/5372_2.png) [@jfausty](https://discourse.vtk.org/u/jfausty)
#### Post date: [May 17, 2023, 12:58pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/13 "2023-05-17T12:58:16Z")

</div>

Right, can you share your data?

---

<div class="post-metadata">

### Author: ![lucasbanting](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasbanting/32/7048_2.png) [@lucasbanting](https://discourse.vtk.org/u/lucasbanting)
#### Post date: [May 17, 2023, 1:05pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/14 "2023-05-17T13:05:00Z")

</div>

[time\_series.hdf](https://discourse.vtk.org/uploads/short-url/sndC1g6iAh5B3s0vmAv5i7GbCCv.hdf) (498.3 KB)

This is a simple example of something that I think should open, but doesn’t.  
If I remove the ‘Steps’ group, it works as a static dataset.

---

<div class="post-metadata">

### Author: ![jfausty](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jfausty/32/5372_2.png) [@jfausty](https://discourse.vtk.org/u/jfausty)
#### Post date: [May 17, 2023, 2:14pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/15 "2023-05-17T14:14:39Z")

</div>

@lucasbanting,

This may very well be a bug that I do not have any more time to investigate.

Please feel free to open an issue at: [https://gitlab.kitware.com/vtk/vtk](https://gitlab.kitware.com/vtk/vtk) and tag me on it.

Best,  
Julien

---

<div class="post-metadata">

### Author: ![logantm2](https://discourse.vtk.org/user_avatar/discourse.vtk.org/logantm2/32/7009_2.png) [@logantm2](https://discourse.vtk.org/u/logantm2)
#### Post date: [May 17, 2023, 3:41pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/16 "2023-05-17T15:41:49Z")

</div>

One subtle thing that I couldn’t find mentioned in the documentation: the `NumberOf*` datasets in the `VTKHDF` group must have length number\_of\_parts \* number\_of\_steps. Since your example only has one part, each of those datasets should have length 18 in your case. Since your mesh isn’t changing, all of the entries should be the same.

That said, when I tried to extend these datasets in your example, it still wasn’t rendered properly in paraview. I’m not sure why that’s the case, but if you want more examples to look at, here’s an hdf file with cell data that I was using to play around with the format. I’m also attaching the python script that generates the file – you can adjust the number of parts there. Ignore the `particles` function – that was for testing the h5part format, a separate thing.

[mytestfile.hdf](https://discourse.vtk.org/uploads/short-url/ep74YV0zBe9uzxfQEJGtBINqBW5.hdf) (138.9 KB)  
[test.py](https://discourse.vtk.org/uploads/short-url/5NNBXjr4I3wcxjLjnIDdlZigVGj.py) (8.6 KB)

---

<div class="post-metadata">

### Author: ![lucasbanting](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasbanting/32/7048_2.png) [@lucasbanting](https://discourse.vtk.org/u/lucasbanting)
#### Post date: [May 17, 2023, 5:07pm UTC](https://discourse.vtk.org/t/how-to-include-a-time-series-in-a-vtkhdf-file/11430/17 "2023-05-17T17:07:06Z")

</div>

That worked!

For reference, here is the working h5 file for anyone who stumbles across this:

```auto
HDF5 "time_series.hdf" {
GROUP "/" {
   GROUP "VTKHDF" {
      ATTRIBUTE "Type" {
         DATATYPE H5T_STRING {
            STRSIZE 16;
            STRPAD H5T_STR_NULLTERM;
            CSET H5T_CSET_ASCII;
            CTYPE H5T_C_S1;
         }
         DATASPACE SCALAR
         DATA {
         (0): "UnstructuredGrid"
         }
      }
      ATTRIBUTE "Version" {
         DATATYPE H5T_STD_I64LE
         DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
         DATA {
         (0): 2, 0
         }
      }
      GROUP "CellData" {
         DATASET "E" {
            DATATYPE H5T_IEEE_F64LE
            DATASPACE SIMPLE { ( 134928, 3 ) / ( 134928, 3 ) }
         }
      }
      DATASET "Connectivity" {
         DATATYPE H5T_STD_I64LE
         DATASPACE SIMPLE { ( 22488 ) / ( 22488 ) }
      }
      DATASET "NumberOfCells" {
         DATATYPE H5T_STD_I64LE
         DATASPACE SIMPLE { ( 18 ) / ( 18 ) }
      }
      DATASET "NumberOfConnectivityIds" {
         DATATYPE H5T_STD_I64LE
         DATASPACE SIMPLE { ( 18 ) / ( 18 ) }
      }
      DATASET "NumberOfPoints" {
         DATATYPE H5T_STD_I64LE
         DATASPACE SIMPLE { ( 18 ) / ( 18 ) }
      }
      DATASET "Offsets" {
         DATATYPE H5T_STD_I64LE
         DATASPACE SIMPLE { ( 7497 ) / ( 7497 ) }
      }
      DATASET "Points" {
         DATATYPE H5T_IEEE_F64LE
         DATASPACE SIMPLE { ( 22488, 3 ) / ( 22488, 3 ) }
      }
      GROUP "Steps" {
         ATTRIBUTE "NSteps" {
            DATATYPE H5T_STD_I64LE
            DATASPACE SCALAR
            DATA {
            (0): 18
            }
         }
         GROUP "CellDataOffsets" {
            DATASET "E" {
               DATATYPE H5T_STD_I64LE
               DATASPACE SIMPLE { ( 18 ) / ( 18 ) }
            }
         }
         DATASET "CellOffsets" {
            DATATYPE H5T_STD_I64LE
            DATASPACE SIMPLE { ( 18, 1 ) / ( 18, 1 ) }
         }
         DATASET "ConnectivityIdOffsets" {
            DATATYPE H5T_STD_I64LE
            DATASPACE SIMPLE { ( 18, 1 ) / ( 18, 1 ) }
         }
         DATASET "PartOffsets" {
            DATATYPE H5T_STD_I64LE
            DATASPACE SIMPLE { ( 18 ) / ( 18 ) }
         }
         DATASET "PointOffsets" {
            DATATYPE H5T_STD_I64LE
            DATASPACE SIMPLE { ( 18 ) / ( 18 ) }
         }
         DATASET "Values" {
            DATATYPE H5T_IEEE_F64LE
            DATASPACE SIMPLE { ( 18 ) / ( 18 ) }
         }
      }
      DATASET "Types" {
         DATATYPE H5T_STD_U8LE
         DATASPACE SIMPLE { ( 7496 ) / ( 7496 ) }
      }
   }
}
}

```

I’ll update the issue in vtk.
