From c2d77e2e5fea0cafc6576d10a97d472aa6616ffb Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Wed, 25 Oct 2023 14:51:17 +0200 Subject: [PATCH 1/4] Use x \ y instead of a \ b --- and.json | 4 ++-- or.json | 4 ++-- xor.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/and.json b/and.json index c24ce95b..3b28c8ef 100644 --- a/and.json +++ b/and.json @@ -1,7 +1,7 @@ { "id": "and", "summary": "Logical AND", - "description": "Checks if **both** values are true.\n\nEvaluates parameter `x` before `y` and stops once the outcome is unambiguous. If any argument is `null`, the result will be `null` if the outcome is ambiguous.\n\n**Truth table:**\n\n```\na \\ b || null | false | true\n----- || ----- | ----- | -----\nnull || null | false | null\nfalse || false | false | false\ntrue || null | false | true\n```", + "description": "Checks if **both** values are true.\n\nEvaluates parameter `x` before `y` and stops once the outcome is unambiguous. If any argument is `null`, the result will be `null` if the outcome is ambiguous.\n\n**Truth table:**\n\n```\nx \\ y || null | false | true\n----- || ----- | ----- | -----\nnull || null | false | null\nfalse || false | false | false\ntrue || null | false | true\n```", "categories": [ "logic" ], @@ -90,4 +90,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/or.json b/or.json index 5964a341..4a83a63e 100644 --- a/or.json +++ b/or.json @@ -1,7 +1,7 @@ { "id": "or", "summary": "Logical OR", - "description": "Checks if **at least one** of the values is true. Evaluates parameter `x` before `y` and stops once the outcome is unambiguous. If a component is `null`, the result will be `null` if the outcome is ambiguous.\n\n**Truth table:**\n\n```\na \\ b || null | false | true\n----- || ---- | ----- | ----\nnull || null | null | true\nfalse || null | false | true\ntrue || true | true | true\n```", + "description": "Checks if **at least one** of the values is true. Evaluates parameter `x` before `y` and stops once the outcome is unambiguous. If a component is `null`, the result will be `null` if the outcome is ambiguous.\n\n**Truth table:**\n\n```\nx \\ y || null | false | true\n----- || ---- | ----- | ----\nnull || null | null | true\nfalse || null | false | true\ntrue || true | true | true\n```", "categories": [ "logic" ], @@ -90,4 +90,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/xor.json b/xor.json index d8dbde50..6af7ae5e 100644 --- a/xor.json +++ b/xor.json @@ -1,7 +1,7 @@ { "id": "xor", "summary": "Logical XOR (exclusive or)", - "description": "Checks if **exactly one** of the values is true. If a component is `null`, the result will be `null` if the outcome is ambiguous.\n\n**Truth table:**\n\n```\na \\ b || null | false | true\n----- || ---- | ----- | -----\nnull || null | null | null\nfalse || null | false | true\ntrue || null | true | false\n```", + "description": "Checks if **exactly one** of the values is true. If a component is `null`, the result will be `null` if the outcome is ambiguous.\n\n**Truth table:**\n\n```\nx \\ y || null | false | true\n----- || ---- | ----- | -----\nnull || null | null | null\nfalse || null | false | true\ntrue || null | true | false\n```", "categories": [ "logic" ], @@ -125,4 +125,4 @@ "result": true } } -} \ No newline at end of file +} From 13c3f85696d6f142f68694ba4726337b1fecca28 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Fri, 27 Oct 2023 11:07:14 +0200 Subject: [PATCH 2/4] `sqrt`: Clarified that NaN is returned for negative numbers #474 (#475) --- CHANGELOG.md | 4 ++++ sqrt.json | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 407447dc..78b16e73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased / Draft +### Fixed + +- `sqrt`: Clarified that NaN is returned for negative numbers. + ## [2.0.0-rc.1] - 2023-05-25 ### Added diff --git a/sqrt.json b/sqrt.json index bc1aeb6c..b85caf94 100644 --- a/sqrt.json +++ b/sqrt.json @@ -1,7 +1,7 @@ { "id": "sqrt", "summary": "Square root", - "description": "Computes the square root of a real number `x`, which is equal to calculating `x` to the power of *0.5*.\n\nA square root of x is a number a such that *`a² = x`*. Therefore, the square root is the inverse function of a to the power of 2, but only for *a >= 0*.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the square root of a real number `x`, which is equal to calculating `x` to the power of *0.5*. For negative `x`, the process returns `NaN`.\n\nA square root of x is a number a such that *`a² = x`*. Therefore, the square root is the inverse function of a to the power of 2, but only for *a >= 0*.\n\nThe no-data value `null` is passed through and therefore gets propagated.", "categories": [ "math", "math > exponential & logarithmic" @@ -58,6 +58,11 @@ "rel": "about", "href": "http://mathworld.wolfram.com/SquareRoot.html", "title": "Square root explained by Wolfram MathWorld" + }, + { + "rel": "about", + "href": "https://ieeexplore.ieee.org/document/8766229", + "title": "IEEE Standard 754-2019 for Floating-Point Arithmetic" } ], "process_graph": { @@ -72,4 +77,4 @@ "result": true } } -} \ No newline at end of file +} From 4fd92b217ec84bfb27273c2d1acdb8418574b7b7 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Fri, 27 Oct 2023 11:08:00 +0200 Subject: [PATCH 3/4] `clip`: Throw an exception if min > max #472 (#477) --- CHANGELOG.md | 4 ++++ clip.json | 40 ++++++++-------------------------------- 2 files changed, 12 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78b16e73..281ab2d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased / Draft +### Changed + +- `clip`: Throw an exception if min > max [#472](https://github.com/Open-EO/openeo-processes/issues/472) + ### Fixed - `sqrt`: Clarified that NaN is returned for negative numbers. diff --git a/clip.json b/clip.json index adbf7eaa..de2a4d1a 100644 --- a/clip.json +++ b/clip.json @@ -1,7 +1,7 @@ { "id": "clip", "summary": "Clip a value between a minimum and a maximum", - "description": "Clips a number between specified minimum and maximum values. A value larger than the maximum value is set to the maximum value, a value lower than the minimum value is set to the minimum value.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Clips a number between specified minimum and maximum values. A value larger than the maximum value is set to the maximum value, a value lower than the minimum value is set to the minimum value. If the maximum value is smaller than the minimum number, the process throws a `MinMaxSwapped` exception.\n\nThe no-data value `null` is passed through and therefore gets propagated.", "categories": [ "math" ], @@ -40,6 +40,11 @@ ] } }, + "exceptions": { + "MinMaxSwapped": { + "message": "The minimum value should be lower than or equal to the maximum value." + } + }, "examples": [ { "arguments": { @@ -73,34 +78,5 @@ }, "returns": null } - ], - "process_graph": { - "min": { - "process_id": "min", - "arguments": { - "data": [ - { - "from_parameter": "max" - }, - { - "from_parameter": "x" - } - ] - } - }, - "max": { - "process_id": "max", - "arguments": { - "data": [ - { - "from_parameter": "min" - }, - { - "from_node": "min" - } - ] - }, - "result": true - } - } -} \ No newline at end of file + ] +} From ab4a62eb3fc3eac0c66a51f5670aa131e52c0745 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Fri, 27 Oct 2023 12:24:32 +0200 Subject: [PATCH 4/4] `array_append`: Added `number` type for labels to be consistent with other processes. Default to numerical index instead of string. (#478) --- CHANGELOG.md | 4 ++++ array_append.json | 22 +++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 281ab2d8..0319d15d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2.0.0-rc.1] - 2023-05-25 +### Fixed + +- `array_append`: Added `number` type for labels to be consistent with other processes. Default to numerical index instead of string. Clarify that the `label` parameter only applies to labeled arrays. + ### Added - New processes in proposal state: diff --git a/array_append.json b/array_append.json index 80b48d12..f09145d2 100644 --- a/array_append.json +++ b/array_append.json @@ -25,15 +25,20 @@ }, { "name": "label", - "description": "If the given array is a labeled array, a new label for the new value should be given. If not given or `null`, the array index as string is used as the label. If in any case the label exists, a `LabelExists` exception is thrown.", + "description": "Provides a label for the new value. If not given or `null`, the natural next array index as number is used as the label. If in any case the label exists, a `LabelExists` exception is thrown.\n\nThis parameter only applies if the given array is a labeled array. If a non-null values is provided and the array is not labeled, an `ArrayNotLabeled` exception is thrown.", "optional": true, "default": null, - "schema": { - "type": [ - "string", - "null" - ] - } + "schema": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "null" + } + ] } ], "returns": { @@ -48,6 +53,9 @@ "exceptions": { "LabelExists": { "message": "An array element with the specified label already exists." + }, + "ArrayNotLabeled": { + "message": "A label can't be provided as the given array is not labeled." } }, "examples": [