# How to find the maximum value on a line

**URL:** https://discourse.paraview.org/t/how-to-find-the-maximum-value-on-a-line/6680
**Category:** Tips and Tricks
**Created:** [March 12, 2021, 2:16am UTC](https://discourse.paraview.org/t/how-to-find-the-maximum-value-on-a-line/6680 "2021-03-12T02:16:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![wascott](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8e8cbc/32.png) [@wascott](https://discourse.paraview.org/u/wascott)
#### Post date: [March 12, 2021, 2:16am UTC](https://discourse.paraview.org/t/how-to-find-the-maximum-value-on-a-line/6680/1 "2021-03-12T02:16:39Z")

</div>

I will show two different cases how to find the maximum value on a line. One has NaNs in the data, the second does not.

#### How to find the maximum value for a Plot over Line. The plot over line includes NaNs.

- Open Examples/ disk\_out\_ref.exo. All variables on. Apply.
- Plot over line. Leave the line as is. It goes through the hollow part of disk\_out\_ref.exo, and these will be sampled as NaNs. Apply.
- Programmable filter. Add the following lines to the Script section:

```auto
1. import numpy as np
2. temp=inputs[0].PointData["Temp"]
3. tempNoNan=np.nan_to_num(temp,nan=0)
4. output.PointData.Append(tempNoNan, "TempNoNan")

```

- Now you have two options. Either run the Descriptive Statistics filter, or add two more lines to the Python above:

```auto
5. tempMax=max(tempNoNan)
6. output.PointData.Append(tempMax, "TempMax")

```

- If you used the Descriptive Statistics filter, you could now show it in a Spreadsheet view, and write this down to a .csv file for post processing.

#### How to find the maximum value on a spline. The plot over line does not include NaNs.

- Open Examples/ disk\_out\_ref.exo. All variables on. Apply.
- Sources/ Spline Source. Add a few more points to the spline, and pull them around. Make it pretty.
- Resample With Dataset. Source Data Arrays: disk\_out\_ref.exo. Destination Mesh: Spline Source. Apply.  
You now have a spline that sampled the variable data in the dataset. Note that you can plot the data on the spline by creating a Line Chart View, and making the filter show in this view.
- Descriptive Statistics filter. Apply.  
You now have the Max of Temp.
