Skip to content

Commit 92b5f40

Browse files
m-mohrsoxofaan
andauthored
is_nan: Return false instead of true for non-numerical data types (#551)
* `is_nan`: Return `false` instead of `true` for non-numerical data types. #486 * Update is_nan.json Co-authored-by: Stefaan Lippens <[email protected]> * Fix tests and examples --------- Co-authored-by: Stefaan Lippens <[email protected]>
1 parent cc0eedc commit 92b5f40

File tree

3 files changed

+46
-65
lines changed

3 files changed

+46
-65
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3030
- Added a uniqueness contraint to various array-typed parameters (e.g. lists of dimension names or labels)
3131
- `apply_polygon`: Renamed `polygons` parameter to `geometries` for better alignment with other geometry handling processes. [#511](https://github.com/Open-EO/openeo-processes/issues/511)
3232
- `clip`: Throw an exception if min > max [#472](https://github.com/Open-EO/openeo-processes/issues/472)
33+
- `is_nan`: Return `false` instead of `true` for non-numerical data types. [#486](https://github.com/Open-EO/openeo-processes/issues/486)
3334
- `save_results`: Returns the STAC resource instead of boolean `true` [API#376](https://github.com/Open-EO/openeo-api/issues/376)
3435

3536
### Fixed

is_nan.json

Lines changed: 36 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,36 @@
1-
{
2-
"id": "is_nan",
3-
"summary": "Value is not a number",
4-
"description": "Checks whether the specified value `x` is *not* a number. Numbers are all integers and floating-point numbers, except for the special value `NaN` as defined by the [IEEE Standard 754](https://ieeexplore.ieee.org/document/4610935).",
5-
"categories": [
6-
"comparison",
7-
"math > constants"
8-
],
9-
"parameters": [
10-
{
11-
"name": "x",
12-
"description": "The data to check.",
13-
"schema": {
14-
"description": "Any data type is allowed."
15-
}
16-
}
17-
],
18-
"returns": {
19-
"description": "Returns `true` for `NaN` and all non-numeric data types, otherwise returns `false`.",
20-
"schema": {
21-
"type": "boolean"
22-
}
23-
},
24-
"examples": [
25-
{
26-
"arguments": {
27-
"x": 1
28-
},
29-
"returns": false
30-
},
31-
{
32-
"arguments": {
33-
"x": "Test"
34-
},
35-
"returns": true
36-
},
37-
{
38-
"arguments": {
39-
"x": null
40-
},
41-
"returns": true
42-
}
43-
],
44-
"links": [
45-
{
46-
"rel": "about",
47-
"href": "https://ieeexplore.ieee.org/document/4610935",
48-
"title": "IEEE Standard 754-2008 for Floating-Point Arithmetic"
49-
},
50-
{
51-
"rel": "about",
52-
"href": "http://mathworld.wolfram.com/NaN.html",
53-
"title": "NaN explained by Wolfram MathWorld"
54-
}
55-
]
56-
}
1+
{
2+
"id": "is_nan",
3+
"summary": "Value is not a number",
4+
"description": "Checks whether the specified value `x` carries the special value `NaN` (not a number) as defined by the [IEEE Standard 754](https://ieeexplore.ieee.org/document/4610935), in which case it returns `true`. Returns `false` otherwise.",
5+
"categories": [
6+
"comparison",
7+
"math > constants"
8+
],
9+
"parameters": [
10+
{
11+
"name": "x",
12+
"description": "The data to check.",
13+
"schema": {
14+
"description": "Any data type is allowed."
15+
}
16+
}
17+
],
18+
"returns": {
19+
"description": "Returns `true` for `NaN` and `false` otherwise.",
20+
"schema": {
21+
"type": "boolean"
22+
}
23+
},
24+
"links": [
25+
{
26+
"rel": "about",
27+
"href": "https://ieeexplore.ieee.org/document/4610935",
28+
"title": "IEEE Standard 754-2008 for Floating-Point Arithmetic"
29+
},
30+
{
31+
"rel": "about",
32+
"href": "http://mathworld.wolfram.com/NaN.html",
33+
"title": "NaN explained by Wolfram MathWorld"
34+
}
35+
]
36+
}

tests/is_nan.json5

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,55 +36,55 @@
3636
"arguments": {
3737
"x": true
3838
},
39-
"returns": true
39+
"returns": false
4040
},
4141
{
4242
"arguments": {
4343
"x": false
4444
},
45-
"returns": true
45+
"returns": false
4646
},
4747
{
4848
"arguments": {
4949
"x": [NaN]
5050
},
51-
"returns": true
51+
"returns": false
5252
},
5353
{
5454
"arguments": {
5555
"x": []
5656
},
57-
"returns": true
57+
"returns": false
5858
},
5959
{
6060
"arguments": {
6161
"x": {}
6262
},
63-
"returns": true
63+
"returns": false
6464
},
6565
{
6666
"arguments": {
6767
"x": {"nan": NaN}
6868
},
69-
"returns": true
69+
"returns": false
7070
},
7171
{
7272
"arguments": {
7373
"x": "NaN"
7474
},
75-
"returns": true
75+
"returns": false
7676
},
7777
{
7878
"arguments": {
7979
"x": "nan"
8080
},
81-
"returns": true
81+
"returns": false
8282
},
8383
{
8484
"arguments": {
8585
"x": {"type": "nodata"}
8686
},
87-
"returns": true
87+
"returns": false
8888
}
8989
]
9090
}

0 commit comments

Comments
 (0)