Skip to main content
Question

RasterExpressionEvaluator and If statement error?

  • April 27, 2016
  • 4 replies
  • 104 views

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?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

takashi
Celebrity
  • 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!


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+8
  • Supporter
  • January 13, 2021

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