forked from eodcgmbh/openeo-processes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
count.json
150 lines (150 loc) · 4.96 KB
/
count.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
141
142
143
144
145
146
147
148
149
150
{
"id": "count",
"summary": "Count the number of elements",
"description": "Gives the number of elements in an array that matches the specified condition.\n\n**Remarks:**\n\n* Counts the number of valid elements by default (`condition` is set to `null`). A valid element is every element for which ``is_valid()`` returns `true`.\n* To count all elements in a list set the `condition` parameter to boolean `true`.",
"categories": [
"arrays",
"math > statistics",
"reducer"
],
"parameters": [
{
"name": "data",
"description": "An array with elements of any data type.",
"schema": {
"type": "array",
"items": {
"description": "Any data type is allowed."
}
}
},
{
"name": "condition",
"description": "A condition consists of one or more processes, which in the end return a boolean value. It is evaluated against each element in the array. An element is counted only if the condition returns `true`. Defaults to count valid elements in a list (see ``is_valid()``). Setting this parameter to boolean `true` counts all elements in the list. `false` is not a valid value for this parameter.",
"schema": [
{
"title": "Condition",
"description": "A logical expression that is evaluated against each element in the array.",
"type": "object",
"subtype": "process-graph",
"parameters": [
{
"name": "x",
"description": "The value of the current element being processed.",
"schema": {
"description": "Any data type."
}
},
{
"name": "context",
"description": "Additional data passed by the user.",
"schema": {
"description": "Any data type."
},
"optional": true,
"default": null
}
],
"returns": {
"description": "`true` if the element should increase the counter, otherwise `false`.",
"schema": {
"type": "boolean"
}
}
},
{
"title": "All elements",
"description": "Boolean `true` counts all elements in the list.",
"type": "boolean",
"const": true
},
{
"title": "Valid elements",
"description": "`null` counts valid elements in the list.",
"type": "null"
}
],
"default": null,
"optional": true
},
{
"name": "context",
"description": "Additional data to be passed to the condition.",
"schema": {
"description": "Any data type."
},
"optional": true,
"default": null
}
],
"returns": {
"description": "The counted number of elements.",
"schema": {
"type": "number"
}
},
"examples": [
{
"arguments": {
"data": []
},
"returns": 0
},
{
"arguments": {
"data": [
1,
0,
3,
2
]
},
"returns": 4
},
{
"arguments": {
"data": [
"ABC",
null
]
},
"returns": 1
},
{
"arguments": {
"data": [
false,
null
],
"condition": true
},
"returns": 2
},
{
"arguments": {
"data": [
0,
1,
2,
3,
4,
5,
null
],
"condition": {
"gt": {
"process_id": "gt",
"arguments": {
"x": {
"from_parameter": "element"
},
"y": 2
},
"result": true
}
}
},
"returns": 3
}
]
}