Question

Handling NaN values

  • 9 May 2023
  • 1 reply
  • 38 views

Badge

I have a workspace that can sometimes generate some NaN-valued Real64 data types (from the surface draper specifically). 

 

I'm really struggling with how to handle these. FME seems very inconsistent with how I can test them. I would like to test for them and terminate the workspace if they are found. 

 

So far I have tried:

  • Attribute Validator by type (numeric)
  • Attribute Validator by 'Has a Value' 
  • Attribute Validator by 'Not Null' 
  • Tester by all of the above

 

The only thing I was able to get to work is a tester using 

@abs(@Value(MyMaybeNANAttribute)) < 0.00000000000000000000001

where I just used the number on the right as an arbitrarily small floating point number. This evaluates to True for my nan values, so I can filter them out. However, this is not a good workaround because I can have valid zero value in some cases.

 

I have searched the forums and the articles and I have not had a good explanation of how NaNs are handled in FME. Is there a way I can catch these with a data validator or a tester? 


1 reply

Userlevel 2
Badge +17

Hi @mlindsvo​,

A NaN value will fail any numeric test, so use a Tester to see if the attribute in question equals itself, in Numeric mode. Only the NaN values will fail.

Reply