forked from Open-EO/openeo-processes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
array_contains.json
140 lines (140 loc) · 4.17 KB
/
array_contains.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
{
"id": "array_contains",
"summary": "Check whether the array contains a given value",
"description": "Checks whether the array specified for `data` contains the value specified in `value`. Returns `true` if there's a match, otherwise `false`.\n\n**Remarks:**\n\n* To get the index or the label of the value found, use ``array_find()``.\n* All definitions for the process ``eq()`` regarding the comparison of values apply here as well. A `null` return value from ``eq()`` is handled exactly as `false` (no match).\n* Data types MUST be checked strictly. For example, a string with the content *1* is not equal to the number *1*.\n* An integer *1* is equal to a floating-point number *1.0* as `integer` is a sub-type of `number`. Still, this process may return unexpectedly `false` when comparing floating-point numbers due to floating-point inaccuracy in machine-based computation.\n* Temporal strings are treated as normal strings and MUST NOT be interpreted.",
"categories": [
"arrays",
"comparison",
"reducer"
],
"parameters": [
{
"name": "data",
"description": "List to find the value in.",
"schema": {
"type": "array",
"items": {
"description": "Any data type is allowed."
}
}
},
{
"name": "value",
"description": "Value to find in `data`. If the value is `null`, this process returns always `false`.",
"schema": {
"type": [
"number",
"boolean",
"string",
"null"
]
}
}
],
"returns": {
"description": "`true` if the list contains the value, false` otherwise.",
"schema": {
"type": "boolean"
}
},
"examples": [
{
"arguments": {
"data": [
1,
2,
3
],
"value": 2
},
"returns": true
},
{
"arguments": {
"data": [
"A",
"B",
"C"
],
"value": "b"
},
"returns": false
},
{
"arguments": {
"data": [
1,
2,
3
],
"value": "2"
},
"returns": false
},
{
"arguments": {
"data": [
1,
2,
null
],
"value": null
},
"returns": false
},
{
"arguments": {
"data": [
[
1,
2
],
[
3,
4
]
],
"value": 2
},
"returns": false
}
],
"links": [
{
"rel": "example",
"type": "application/json",
"href": "https://raw.githubusercontent.com/Open-EO/openeo-community-examples/main/processes/array_contains_nodata.json",
"title": "Check for no-data values in arrays"
}
],
"process_graph": {
"find": {
"process_id": "array_find",
"arguments": {
"data": {
"from_parameter": "data"
},
"value": {
"from_parameter": "value"
}
}
},
"is_nodata": {
"process_id": "is_nodata",
"arguments": {
"x": {
"from_node": "find"
}
}
},
"not": {
"process_id": "not",
"arguments": {
"x": {
"from_node": "is_nodata"
}
},
"result": true
}
}
}