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:
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:
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.