Skip to main content
Question

How to change NaN to NoData?


makt
Contributor
Forum|alt.badge.img+1
  • Contributor
I have a workflow where I am creating a raster using SurfaceModeler. As documented, this transformer may output some NaN values when using PLANAR interpolation. I indeed have a few cells that come out with a NaN value.

 

 

I am not certain what transformer can change my NaN values to NoData values (or any other values)?

 

 

I read through this article: http://blog.safe.com/2013/11/fmeevangelist119/

 

and thought the NullAttributeMapper would be the answer, but it does not seem so.

 

 

 

10 replies

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • November 17, 2014
try the nodatasetter.

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • November 18, 2014

 

Hi,

 

 

Have you tried setting a preferable Nodata value to the "Output DEM Raster Nodata Value" parameter of the SurfaceModeller?

 

 

Takashi

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • November 18, 2014
Your error suggest that the value nan is not acceptable for a raster , try a numeric value such as 9999 or 0 for your nodata value.

makt
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • November 18, 2014
Hey Talashi - I already have a NoData value that is working, which is -32767.0, then I also have NaN cells as well so I don't think this setting is what I am looking for.

 

 

Itay - I think you are getting at the NoData value? My understanding of NaN is that is is not a number so it would not be 9999 or 0.

 

 

To simply my question: given that you have a 32 bit raster that has normal double values, has a NoData value set as -32767.0, and also has NaN values, what is the simplest way to make the NaN values into NoData values?

 

 

I have managed to do this but I'm not sure how efficient the process would be with larger datasets:

 

I first convert the raster to points, then do a AttributeClassifier (passing only points that are "double") and then using NumericRasterizer to arrive back at a raster. This does the trick but is there a more efficient method?

 

 

 

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • November 18, 2014
I would try the RasterCellValueReplacer, but I have my doubts about it....

makt
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • November 18, 2014
Just tried RasterCellValueReplacer, if I input 'nan' into the parameters, the output is a blank raster, so I don't think it is meant to replace a nan value. 

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • November 18, 2014

It seems that "nan" is treated internally as a numeric value smaller than any valid value when comparing values.

Try the RasterCellValueReplacer with this setting:

Replace Values <=: -32767

New Value: -32767


makt
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • November 19, 2014
much more efficient !

 

thanks to you both

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • June 16, 2019
takashi wrote:

It seems that "nan" is treated internally as a numeric value smaller than any valid value when comparing values.

Try the RasterCellValueReplacer with this setting:

Replace Values <=: -32767

New Value: -32767

An application. This workflow removes every "nan" point from the source point cloud feature.


pdorio
Contributor
Forum|alt.badge.img+4
  • Contributor
  • September 17, 2024

By me works well with raster with NaN nan or -nan Nodata value:

  1. RasterPropertyExtractor
  2. PointCloudCombiner with options: Extract NoData = No

  3. NumericRasterizer, set Cell Spacing and extent with the value extracted with RasterPropertyExtractor. Set your nodata value, example -9999

     


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings