# Calculate \[value of the current timestep - value of the previous timestep\] of a variable

**URL:** https://discourse.paraview.org/t/calculate-value-of-the-current-timestep-value-of-the-previous-timestep-of-a-variable/5250
**Category:** ParaView Support
**Created:** [September 2, 2020, 8:39pm UTC](https://discourse.paraview.org/t/calculate-value-of-the-current-timestep-value-of-the-previous-timestep-of-a-variable/5250 "2020-09-02T20:39:53Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![leopessanha](https://discourse.paraview.org/user_avatar/discourse.paraview.org/leopessanha/32/289_2.png) [@leopessanha](https://discourse.paraview.org/u/leopessanha)
#### Post date: [September 2, 2020, 8:39pm UTC](https://discourse.paraview.org/t/calculate-value-of-the-current-timestep-value-of-the-previous-timestep-of-a-variable/5250/1 "2020-09-02T20:39:53Z")

</div>

Hi!

I am creating a rain precipitation vizualization with ParaView and the hourly variable that stores the information is cumulative

Timestep 0 = Timestep 0  
Timestep 1 = Timestep 0 + Timestep 1  
Timestep 2 = Timestep 0 + Timestep 1 + Timestep 2

I would like to visualize the difference between the current timestep and the previous one, so it demonstrate the hourly value, not the total accumulation

Is that possible?

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [September 2, 2020, 9:42pm UTC](https://discourse.paraview.org/t/calculate-value-of-the-current-timestep-value-of-the-previous-timestep-of-a-variable/5250/2 "2020-09-02T21:42:07Z")

</div>

You can use the `Temporal Shift Scale` filter to get a copy of the data set at a different timestep. Both the data from the original reader and the data from the temporal shift will be available in the pipeline, so you can use them together.

I’m not sure what you mean by “visualize the difference,” but perhaps you want to use `Append Attributes` and then the `Calculator` filter to take the difference of the same field from the two different datasets (i.e. datasets from different times).

---

<div class="post-metadata">

### Author: ![leopessanha](https://discourse.paraview.org/user_avatar/discourse.paraview.org/leopessanha/32/289_2.png) [@leopessanha](https://discourse.paraview.org/u/leopessanha)
#### Post date: [September 9, 2020, 4:50pm UTC](https://discourse.paraview.org/t/calculate-value-of-the-current-timestep-value-of-the-previous-timestep-of-a-variable/5250/3 "2020-09-09T16:50:28Z")

</div>

Thank you, Kenneth! It worked =)

After using your way it came to my mind to do it in the following manner:

Use the `TemporalArrayOperator ` on the dataset with the variable used

Add a track in the `AnimationView` with the properties `First Time Step Index` and `Second Time Step Index` of the TemporalArrayOperator one going from [1, maxtime] and [0, maxtime-1]

 ![UYkUXCZlLy](https://discourse.paraview.org/uploads/default/original/2X/8/8b4a8b1a69dafbe03268bc72e574afa242ada5c7.gif)

This way the calculator filter don’t throw an error when it gets to the last timestep thats shifted by one.

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [September 9, 2020, 6:45pm UTC](https://discourse.paraview.org/t/calculate-value-of-the-current-timestep-value-of-the-previous-timestep-of-a-variable/5250/4 "2020-09-09T18:45:23Z")

</div>

Nice solution! I forgot about the `Temporal Array Operator` filter, and that’s a clever use of the animation controls.

---

<div class="post-metadata">

### Author: ![suoyafan](https://discourse.paraview.org/user_avatar/discourse.paraview.org/suoyafan/32/10419_2.png) [@suoyafan](https://discourse.paraview.org/u/suoyafan)
#### Post date: [February 22, 2023, 4:09am UTC](https://discourse.paraview.org/t/calculate-value-of-the-current-timestep-value-of-the-previous-timestep-of-a-variable/5250/5 "2023-02-22T04:09:00Z")

</div>

I think the data processing I want to conduct is similar, but after reading the conversation and trying “TemporalArrayOperator” I am still not sure how the problem was solved (I am not familiar with these filters). Can anyone explain the details? I have a variable called “exhumation” that records my model’s cumulative exhumation. Now I want to calculate the exhumation rate for every timestep. Therefore, I want to create a new variable “ExhumationRate”: ExhumationRate = [Exhumation(timestep=N) - Exhumation(timestep=N-1)]/timestep. Finally, I want to make a movie of the exhumation rate map over time.and use “plot selection over time” for a selected cell to see the exhumation rate change over time at one location.
