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)?
and thought the NullAttributeMapper would be the answer, but it does not seem so.
Â
Â
Â
Page 1 / 1
try the nodatasetter.
Â
Hi,
Â
Â
Have you tried setting a preferable Nodata value to the "Output DEM Raster Nodata Value" parameter of the SurfaceModeller?
Â
Â
Takashi
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.
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?
Â
Â
Â
I would try the RasterCellValueReplacer, but I have my doubts about it....
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.Â
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
much more efficient !
Â
thanks to you both
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.
By me works well with raster with NaN nan or -nan Nodata value:
RasterPropertyExtractor
PointCloudCombiner with options: Extract NoData = No
NumericRasterizer, set Cell Spacing and extent with the value extracted with RasterPropertyExtractor. Set your nodata value, example -9999
Â
I’ve just tried this in FME 2025.1 but there doesn’t seem to be a real solution to this. I tried (various combinations of):
None of the above seems to handle the nan values. As a workaround I’ve tried:
RasterCellCoercer: Extract Nodata Values - No: this still extracts nan-cells! Need to combine this with a Tester afterwards to remove band values < -9999 (or similar)
PointCloudCombiner: Extract Nodata - No: this works
Both workarounds add a lot of unnecessary processing, especially with large raster files, and they would require rebuilding a raster if required.
Â
The only other option I can see is manipulating the raster geometry via a PythonCaller.
Â
Have I missed something - any other suggestions?
But what are the real values of the rastercell in binary? This could give a hint in the solution.
​@jkr_wrk the IMG raster was created with -999 as nodata value and defined as such.
And where does the NaN come from?
The cell values are numeric/floating. Setting a value to -999 is done on the cell value and calling -999 NoData is done in the 'metadata’.
If you convert your service to a raster and click on a location that had a nan value does it appear as -999 or NoData or does it appear as some other value?
I probably just don’t understand the problem fully, so could be dumb questions.
​@jkr_wrk thanks, I probably should have been clearer. No dumb questions!
The raster is being read directly via the ERDAS IMG reader. When I read the raster, the values in question come through as nan and do display as nan in the data inspector. I will need to manage the nodata values, ideally without conversion to vectors.
I do know that the original nodata value was -999 when the raster was written as IMG, plus the nodata value shows as -999 in the ArcPro raster metadata as well.
I was hoping the IMG reader would allow controlling the way nodata is being reproduced but I can’t see a relevant parameter there.
Did you try the nodata remover?
Yes, as per my post above.Â
I can’t think of any other solutions at this moment. Could you supply a small sample data? And your current not working transformers? Maybe someone else has an revelation when looking at the not working sample.
Are you able to extract all cells which are >=0 OR <=0? I would expect this should not include NaN?