# Difference between 2 Datasets

**URL:** https://discourse.paraview.org/t/difference-between-2-datasets/7337
**Category:** ParaView Support
**Created:** [June 1, 2021, 1:43pm UTC](https://discourse.paraview.org/t/difference-between-2-datasets/7337 "2021-06-01T13:43:04Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![frank\_forster](https://discourse.paraview.org/user_avatar/discourse.paraview.org/frank_forster/32/6643_2.png) [@frank\_forster](https://discourse.paraview.org/u/frank_forster)
#### Post date: [June 1, 2021, 1:43pm UTC](https://discourse.paraview.org/t/difference-between-2-datasets/7337/1 "2021-06-01T13:43:04Z")

</div>

Hello,  
How can I get the difference about one component between two datasets ?  
Let’s say one layer is 15°C and the other 10°C, I’d like to have a new layer with a field filled with -5°C.  
Thanks, Frank

---

<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: [June 1, 2021, 1:45pm UTC](https://discourse.paraview.org/t/difference-between-2-datasets/7337/2 "2021-06-01T13:45:02Z")

</div>

AppendAttributes + Calculator

---

<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: [June 1, 2021, 1:48pm UTC](https://discourse.paraview.org/t/difference-between-2-datasets/7337/3 "2021-06-01T13:48:02Z")

</div>

You might need either `Append Attributes` or `Resample with Dataset` depending on the structure of your data. See, for example: [Visualization of data using Paraview - #7 by Kenneth\_Moreland](https://discourse.paraview.org/t/visualization-of-data-using-paraview/4703/7)

---

<div class="post-metadata">

### Author: ![frank\_forster](https://discourse.paraview.org/user_avatar/discourse.paraview.org/frank_forster/32/6643_2.png) [@frank\_forster](https://discourse.paraview.org/u/frank_forster)
#### Post date: [June 1, 2021, 2:08pm UTC](https://discourse.paraview.org/t/difference-between-2-datasets/7337/4 "2021-06-01T14:08:39Z")

</div>

Hello and thanks for your answer,  
I still have the same value on the “calculator”. Do I have a formula to write ?

 ![image](https://discourse.paraview.org/uploads/default/original/2X/3/31b839c39fc0cdf2c22fad31380d2fafcf4c74ee.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: [June 1, 2021, 2:18pm UTC](https://discourse.paraview.org/t/difference-between-2-datasets/7337/5 "2021-06-01T14:18:14Z")

</div>

Yes, write something like:

`Temp0 - Temp1`

---

<div class="post-metadata">

### Author: ![frank\_forster](https://discourse.paraview.org/user_avatar/discourse.paraview.org/frank_forster/32/6643_2.png) [@frank\_forster](https://discourse.paraview.org/u/frank_forster)
#### Post date: [June 2, 2021, 10:23am UTC](https://discourse.paraview.org/t/difference-between-2-datasets/7337/6 "2021-06-02T10:23:35Z")

</div>

Hello,  
After some research, I’ve done it using a ProgrammableFilter with the following :  
Thanks @mwestphal and @Kenneth_Moreland, Frank.  
 ![image](https://discourse.paraview.org/uploads/default/original/2X/5/5102cf04e225ef38509cd1d845c00e3369875b1e.png)

 ![image](https://discourse.paraview.org/uploads/default/original/2X/a/ab9dc574d8e89f56e54a9eef2305eb798d9d9380.png)

---

<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: [June 3, 2021, 3:43pm UTC](https://discourse.paraview.org/t/difference-between-2-datasets/7337/7 "2021-06-03T15:43:27Z")

</div>

To do it in python you can also use the python calculator, with the one-liner  
`inputs[1].PointData["TMRT"] - inputs[0].PoindData["TMRT"]`

---

<div class="post-metadata">

### Author: ![frank\_forster](https://discourse.paraview.org/user_avatar/discourse.paraview.org/frank_forster/32/6643_2.png) [@frank\_forster](https://discourse.paraview.org/u/frank_forster)
#### Post date: [June 3, 2021, 7:08pm UTC](https://discourse.paraview.org/t/difference-between-2-datasets/7337/8 "2021-06-03T19:08:49Z")

</div>

Way more convenient, thank you @nicolas.vuaille !

---

<div class="post-metadata">

### Author: ![zj519](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/z/8797f3/32.png) [@zj519](https://discourse.paraview.org/u/zj519)
#### Post date: [January 22, 2024, 4:22pm UTC](https://discourse.paraview.org/t/difference-between-2-datasets/7337/9 "2024-01-22T16:22:28Z")

</div>

Hi Nicolas,

I’m trying to calculate mean sqaured error (MSE) between two datasets. I have used resample with dataset to make the two vtu fils have same number of cells and same number of points.

Now, i use the python calculator, but get an error as shown on the screenshot  
May I kindly ask how this should be resolved please?

 ![image](https://discourse.paraview.org/uploads/default/original/2X/d/d00ff83bb14b8e8554665580c07f805dd3184af2.png)

---

<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: [January 22, 2024, 4:59pm UTC](https://discourse.paraview.org/t/difference-between-2-datasets/7337/10 "2024-01-22T16:59:58Z")

</div>

Hi @zj519 ,

You have selected only one source in the pipeline for the `Python Calculator` input, so `inputs[1]` does not exist.
