# How to subtract time(t) data from time(t-1) data

**URL:** https://discourse.paraview.org/t/how-to-subtract-time-t-data-from-time-t-1-data/11531
**Category:** ParaView Support
**Created:** [February 28, 2023, 9:25am UTC](https://discourse.paraview.org/t/how-to-subtract-time-t-data-from-time-t-1-data/11531 "2023-02-28T09:25:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![hideaki.kominami](https://discourse.paraview.org/user_avatar/discourse.paraview.org/hideaki.kominami/32/11038_2.png) [@hideaki.kominami](https://discourse.paraview.org/u/hideaki.kominami)
#### Post date: [February 28, 2023, 9:25am UTC](https://discourse.paraview.org/t/how-to-subtract-time-t-data-from-time-t-1-data/11531/1 "2023-02-28T09:25:41Z")

</div>

I need to visualize a displacement field with its previous time, spatially-varying displacement field subtracted off.

The displacement field after the calculation is performed should be visualized by subtracting the first non-zero spatially varying displacement field.  
Essentially, at every element I want [displacement(t) – displacement(t-1)].

I read “How to subtract time(t) data from time(0) data” on Jun '18,2018,and actually I did.

I thought ‘Python Calculator’ filter and ‘Force Time’ filter may work for this but I don’t know how to set previous time with ‘Force Time’ filter.

Do you have any suggestions?

[How to subtract time(t) data from time(0) data - ParaView Support - ParaView](https://discourse.paraview.org/t/how-to-subtract-time-t-data-from-time-0-data/130/12)

---

<div class="post-metadata">

### Author: ![nicolas.vuaille](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nicolas.vuaille/32/5873_2.png) [@nicolas.vuaille](https://discourse.paraview.org/u/nicolas.vuaille)
#### Post date: [March 1, 2023, 12:25pm UTC](https://discourse.paraview.org/t/how-to-subtract-time-t-data-from-time-t-1-data/11531/2 "2023-03-01T12:25:24Z")

</div>

See `Temporal Array Operator` filter, it is the exact use case.

---

<div class="post-metadata">

### Author: ![hideaki.kominami](https://discourse.paraview.org/user_avatar/discourse.paraview.org/hideaki.kominami/32/11038_2.png) [@hideaki.kominami](https://discourse.paraview.org/u/hideaki.kominami)
#### Post date: [March 3, 2023, 2:34am UTC](https://discourse.paraview.org/t/how-to-subtract-time-t-data-from-time-t-1-data/11531/3 "2023-03-03T02:34:44Z")

</div>

Thank for reply.

I found it in the cited articles, ‘the temporal array operator does not handle working with the current timestep, it works on static timesteps.’ I found it in the cited articles, ‘However, the Python Calculater + Programmable filter would update when you change the time you are viewing, so it is animation friendly.’

I apologize for the inadequate initial explanation.  
I need to visualize a displacement field with its previous time, spatially-varying displacement field subtracted off.  
The displacement field after the calculation is performed should be visualized by subtracting the first non-zero spatially varying displacement field.  
Essentially, at every element and any timeStep I want [displacement(present-timeStep) – displacement(previous-timeStep)].

---

<div class="post-metadata">

### Author: ![nicolas.vuaille](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nicolas.vuaille/32/5873_2.png) [@nicolas.vuaille](https://discourse.paraview.org/u/nicolas.vuaille)
#### Post date: [March 3, 2023, 8:50am UTC](https://discourse.paraview.org/t/how-to-subtract-time-t-data-from-time-t-1-data/11531/4 "2023-03-03T08:50:22Z")

</div>

Oh, sorry, I misread the filter doc this time …

The fact is that most filters cannot access different timesteps, so you need to find a temporal filter.

So two ways to go.

1. First, if you have constant delta time in your data, I advise to use `Temporal Shift Scale` filter. And, for instance, set up `Pre Shift` to `-delta T` (whith the actual numerical value, no expression here).  
Then you can follow the linked post, and add `Append Attributes` and `Calculator`, or directly a `Python Calculator` with both inputs.
2. Second option. You can animate the `Temporal Array Operator` to follow current time. (see this [animation tutorial](https://docs.paraview.org/en/latest/Tutorials/ClassroomTutorials/advancedAnimations.html#animating-a-filter) )

---

<div class="post-metadata">

### Author: ![hideaki.kominami](https://discourse.paraview.org/user_avatar/discourse.paraview.org/hideaki.kominami/32/11038_2.png) [@hideaki.kominami](https://discourse.paraview.org/u/hideaki.kominami)
#### Post date: [March 7, 2023, 2:38am UTC](https://discourse.paraview.org/t/how-to-subtract-time-t-data-from-time-t-1-data/11531/5 "2023-03-07T02:38:47Z")

</div>

Thank you very much. The number 1 method worked.
