# Subtract scalar on different slices

**URL:** https://discourse.paraview.org/t/subtract-scalar-on-different-slices/10971
**Category:** ParaView Support
**Created:** [December 14, 2022, 10:48am UTC](https://discourse.paraview.org/t/subtract-scalar-on-different-slices/10971 "2022-12-14T10:48:15Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![rcarneiro](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/f14d63/32.png) [@rcarneiro](https://discourse.paraview.org/u/rcarneiro)
#### Post date: [December 14, 2022, 10:48am UTC](https://discourse.paraview.org/t/subtract-scalar-on-different-slices/10971/1 "2022-12-14T10:48:15Z")

</div>

Hello everyone,

I would like to know if, in Paraview, is possible to subtract the temperature of 2 slices that are at different heights in the same computational domain?  
The result would be a matrix with the result of the subtraction …

In the attached file you can see an example.

![TdiffSlice](https://discourse.paraview.org/uploads/default/original/2X/2/23ca86bce1d3352cd5cb416d3e64cd0aef045844.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 14, 2022, 12:07pm UTC](https://discourse.paraview.org/t/subtract-scalar-on-different-slices/10971/2 "2022-12-14T12:07:43Z")

</div>

Hi @rcarneiro

If you input is a structured grid, then your two slices should contains the same number of points and cells.

Then computing anything between the two slides would be trivial using PythonCalculator filter.

---

<div class="post-metadata">

### Author: ![rcarneiro](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/f14d63/32.png) [@rcarneiro](https://discourse.paraview.org/u/rcarneiro)
#### Post date: [December 14, 2022, 12:20pm UTC](https://discourse.paraview.org/t/subtract-scalar-on-different-slices/10971/3 "2022-12-14T12:20:05Z")

</div>

Something like this? My question now is, how do I refer to the temperature of the slice 1 and slice 2 in the python calculator? Note that the data array name is the same (TEMPERATURE).

![PythonCalc](https://discourse.paraview.org/uploads/default/original/2X/7/7b2a568bf800c2dc24f4d59e43ed50b4304e0f94.png)

Thank you.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 14, 2022, 12:31pm UTC](https://discourse.paraview.org/t/subtract-scalar-on-different-slices/10971/4 "2022-12-14T12:31:27Z")

</div>

`inputs[0].PointData["TEMPERATURE"] - inputs[1].PointData["TEMPERATURE"]`

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [December 14, 2022, 2:19pm UTC](https://discourse.paraview.org/t/subtract-scalar-on-different-slices/10971/5 "2022-12-14T14:19:54Z")

</div>

Are quotes needed around `TEMPERATURE` ?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 14, 2022, 2:48pm UTC](https://discourse.paraview.org/t/subtract-scalar-on-different-slices/10971/6 "2022-12-14T14:48:51Z")

</div>

edited

---

<div class="post-metadata">

### Author: ![rcarneiro](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/f14d63/32.png) [@rcarneiro](https://discourse.paraview.org/u/rcarneiro)
#### Post date: [December 14, 2022, 2:48pm UTC](https://discourse.paraview.org/t/subtract-scalar-on-different-slices/10971/7 "2022-12-14T14:48:53Z")

</div>

Yes,quotes are needed.  
And if you are working with cell data use: CellData[“TEMPERATURE”]

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [October 23, 2023, 12:11pm UTC](https://discourse.paraview.org/t/subtract-scalar-on-different-slices/10971/8 "2023-10-23T12:11:05Z")

</div>

A post was split to a new topic: [Using python calculator](https://discourse.paraview.org/t/using-python-calculator/13082)

---

<div class="post-metadata">

### Author: ![scabo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/a6a055/32.png) [@scabo](https://discourse.paraview.org/u/scabo)
#### Post date: [August 3, 2024, 2:42pm UTC](https://discourse.paraview.org/t/subtract-scalar-on-different-slices/10971/9 "2024-08-03T14:42:04Z")

</div>

how does this line imply that they are only refering to the slices and not any other geometry in the pipeline? What is i have more slices in the pipeline and i want to refer to 2 specific slices or surface vectors on the slices?
