# Time series data in pyvista - XdmfReader

**URL:** <https://fenicsproject.discourse.group/t/time-series-data-in-pyvista-xdmfreader/11126>\
**Category:** I/O\
**Created:** [May 8, 2023, 9:01pm UTC](https://fenicsproject.discourse.group/t/time-series-data-in-pyvista-xdmfreader/11126 "2023-05-08T21:01:14Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![nav](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/nav/32/5225_2.png) [@nav](https://fenicsproject.discourse.group/u/nav)\
**Post date:** [November 18, 2024, 6:19pm UTC](https://fenicsproject.discourse.group/t/time-series-data-in-pyvista-xdmfreader/11126/5 "2024-11-18T18:19:14Z")

</div>

> [@renol-kth](#):
>
> Or in other words: if I call the script from my previous message and remove everything after the line
> 
> ```auto
> xdmf.close()
> 
> ```
> 
> it runs without returning any errors.

This suggests to me that it is entirely a pyvista problem. I just installed pyvista 0.42.3. When I run the following with `python`

```auto
import pyvista as pv

def plot_sol(func, min, max):
    """ Analyse 2d solution over time """
    cmap = "plasma"
    def load_time(value):
        """ Load solution at value specified using the slider """
        reader.set_active_time_value(value)
        grid = reader.read()[1]
        grid.set_active_scalars(func)
        p.add_mesh(grid, cmap=cmap, clim=[min, max], scalar_bar_args=sargs)

    # Load in data
    xdmf_file = "phi.xdmf"
    reader = pv.get_reader(xdmf_file)
    reader.set_active_time_value(0.0)
    grid = reader.read()[1]
    grid.set_active_scalars(func)
    # Create plot
    width = 0.6
    sargs = dict(width=width, height=0.1, position_x=(1-width)/2, position_y=0.01)
    p = pv.Plotter()
    p.add_mesh(grid, cmap=cmap, clim=[min, max], scalar_bar_args=sargs)
    p.show_bounds(xtitle="", ytitle="", ztitle="")
    p.view_xy()
    p.add_slider_widget(load_time, [0.0, 1.0], value=0.0, title="Time",
                        interaction_event="always", pointa=(0.25, 0.93), 
                        pointb=(0.75, 0.93))
    p.show()

plot_sol("phi", 0.0, 1.1)

```

it all works fine with no errors. Is this the case with you, as well?

---

_[View the full topic](https://fenicsproject.discourse.group/t/time-series-data-in-pyvista-xdmfreader/11126)._
