# Nan is legacy ascii files

**URL:** https://discourse.paraview.org/t/nan-is-legacy-ascii-files/4972
**Category:** ParaView Support
**Created:** [July 28, 2020, 12:06pm UTC](https://discourse.paraview.org/t/nan-is-legacy-ascii-files/4972 "2020-07-28T12:06:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![marios\_geo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@marios\_geo](https://discourse.paraview.org/u/marios_geo)
#### Post date: [July 28, 2020, 12:06pm UTC](https://discourse.paraview.org/t/nan-is-legacy-ascii-files/4972/1 "2020-07-28T12:06:02Z")

</div>

Hi, I am reading some ascii vtk files, and based on the properties (on the SCALARS section of the file) I want to replace values less than a threshold to NaN.

I read some previous posts and it seems that NaN is not supported to ascii files. Is any trick that I can set the nan to a value (say -99) and then make it transparent in paraview?

---

<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: [August 3, 2020, 7:45pm UTC](https://discourse.paraview.org/t/nan-is-legacy-ascii-files/4972/2 "2020-08-03T19:45:18Z")

</div>

First, I’ll say that if all that you are interested in is removing or making invisible all values of a certain type, you can use the `Threshold` filter to remove cells based on field values.

If for other reasons you want to keep all the points but make some NaN values, you can use the `Programmable Filter` to write a numpy expression that changes all values matching an expression to NaN. Add a `Programmable Filter` and use something like the following for the `Script` to make all values less than 0 be NaN:

```auto
indata = inputs[0].PointData['field_name']

# Copy numpy array
outdata = numpy.array(indata)
# Replace some values with NaN
outdata[outdata < 0] = float('nan')

output.PointData.append(outdata, 'field_name')

```

Of course, change `field_name` to the name of the scalars in your data. You can also change the `outdata < 0` expression to something like `outdata == -99`. However, using `==` with floating point numbers sometimes does not work, so I would suggest using something like `(outdata < -98.9) & (outdata > -99.1)` instead.
