Open-EO / openeo-processes

Interoperable processes for openEO's big Earth observation cloud processing.
https://processes.openeo.org
Apache License 2.0
48 stars 17 forks source link

is_nan: Restrict to numbers and add is_numerical #486

Open m-mohr opened 11 months ago

m-mohr commented 11 months ago

Process ID: is_nan / is_numerical

Describe the issue: is_nan is a bit weird in that it also returns true for data types that are not numbers.

Proposed solution: Make is_nan be compliant with most other languages and only return True if the value is actual a float NaN.

The existing behavior could be inversed and be part of a new process is_numerical (returns true for all integers and floating point numbers except for NaN, false for NaN and all non-numerical data types).

Any opinions? @soxofaan @clausmichele

soxofaan commented 11 months ago

and what should is_nan("a string") or is_nan([1, 2, 3]) result in? False or throw an error?

m-mohr commented 11 months ago

An error because the data type would not be allowed any longer.

I'm not sure whether the proposed change is required, it just looks like the current implementations don't implement it correctly anyway.