Skip to main content
Question

RasterExpressionEvaluator and If statement error?


Forum|alt.badge.img

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?

4 replies

takashi
Evangelist
  • April 27, 2016

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.


Forum|alt.badge.img
  • Author
  • April 27, 2016

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


takashi wrote:

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!

 

 


mathiku
Supporter
Forum|alt.badge.img+7
  • Supporter
  • January 13, 2021
takashi wrote:

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


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