Skip to main content

I have a single band numeric raster on which I wish to cap the max values. I read in as tiff and then run through the RasterExpressionEvaluator with a simple if statement as follows:

The output I send to the data inspector - but this is where it gets confusing as all the cells which have values greater than or equal to 20 are now set to NoData (0) and are NOT set to 20.0:

In effect the @if statement seems to be ignoring the 'else' option. What am I doing wrong?

Hi @turner537, I've come across a similar situation before. I don't know the exact reason, but it seems that the unexpected result could occur depending on the Nodata definition of the source raster.
As an interim workaround, try this.

  1. RasterBandNodataRemover: Remove the Nodata definition from the source raster.

  2. RasterExpressionEvaluator: Modify cell values.

  3. RasterBandNodataSetter: Restore the Nodata definition.

Hope this solves the problem.


Hi @takashi, that workaround does the job. Many thanks!


Hi @turner537, I've come across a similar situation before. I don't know the exact reason, but it seems that the unexpected result could occur depending on the Nodata definition of the source raster.
As an interim workaround, try this.

  1. RasterBandNodataRemover: Remove the Nodata definition from the source raster.

  2. RasterExpressionEvaluator: Modify cell values.

  3. RasterBandNodataSetter: Restore the Nodata definition.

Hope this solves the problem.

I had the same problem, thanks for the workaround!

 

 


Hi @turner537, I've come across a similar situation before. I don't know the exact reason, but it seems that the unexpected result could occur depending on the Nodata definition of the source raster.
As an interim workaround, try this.

  1. RasterBandNodataRemover: Remove the Nodata definition from the source raster.

  2. RasterExpressionEvaluator: Modify cell values.

  3. RasterBandNodataSetter: Restore the Nodata definition.

Hope this solves the problem.

Still works in FME 2020.2


Reply