-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathapply_neighborhood.json
315 lines (315 loc) · 14.5 KB
/
apply_neighborhood.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
{
"id": "apply_neighborhood",
"summary": "Apply a process to pixels in a n-dimensional neighborhood",
"description": "Applies a focal process to a data cube.\n\nA focal process is a process that works on a 'neighborhood' of pixels. The neighborhood can extend into multiple dimensions, this extent is specified by the `size` argument. It is not only (part of) the size of the input window, but also the size of the output for a given position of the sliding window. The sliding window moves with multiples of `size`.\n\nAn overlap can be specified so that neighborhoods can have overlapping boundaries. This allows for continuity of the output. The overlap region must be included in the data cube or array returned by `process`, but any changed values will be ignored. The missing overlap at the borders of the original data cube is made available as no-data (`null`) in the sub-data cubes.\n\nThe neighborhood size should be kept small enough, to avoid running beyond computational resources, but a too-small size will result in a larger number of process invocations, which may slow down processing. Window sizes for spatial dimensions typically range from 64 to 512 pixels, while overlaps of 8 to 32 pixels are common.\n\nFor the special case of 2D convolution, it is recommended to use ``apply_kernel()``.",
"categories": [
"cubes"
],
"parameters": [
{
"name": "data",
"description": "A raster data cube.",
"schema": {
"type": "object",
"subtype": "datacube",
"dimensions": [
{
"type": "spatial",
"axis": [
"x",
"y"
]
}
]
}
},
{
"name": "process",
"description": "Process to be applied on all neighborhoods.",
"schema": {
"type": "object",
"subtype": "process-graph",
"parameters": [
{
"name": "data",
"description": "The input data, which is a subset of the data cube as specified in `size` and `overlap`. If the given size and overlap result in a one-dimensional data cube it is converted to a labeled array.",
"schema": [
{
"title": "Multi-dimensional data",
"type": "object",
"subtype": "datacube",
"dimensions": [
{
"type": "spatial",
"axis": [
"x",
"y"
]
}
]
},
{
"title": "One-dimensional data",
"type": "array",
"subtype": "labeled-array"
}
]
},
{
"name": "context",
"description": "Additional data passed by the user.",
"schema": {
"description": "Any data type."
},
"optional": true,
"default": null
}
],
"returns": {
"description": "An array or data cube with the newly computed values. The data type and dimensionality must correspond to the input data.\n\n* Data cubes must have the same dimensions and the dimension properties (name, type, labels, reference system and resolution) must remain unchanged. Otherwise, a `DataCubePropertiesImmutable` exception will be thrown.\n* Arrays can be returned with or without labels.",
"schema": [
{
"title": "Multi-dimensional data",
"type": "object",
"subtype": "datacube",
"dimensions": [
{
"type": "spatial",
"axis": [
"x",
"y"
]
}
]
},
{
"title": "One-dimensional data",
"type": "array"
}
]
}
}
},
{
"name": "size",
"description": "Neighborhood sizes along each dimension.\n\nThis object maps dimension names to either a physical measure (e.g. 100 m, 10 days) or pixels (e.g. 32 pixels). For dimensions not specified, the default is to provide all values. Be aware that including all values from overly large dimensions may not be processed at once.",
"schema": {
"type": "array",
"items": {
"type": "object",
"subtype": "chunk-size",
"required": [
"dimension",
"value"
],
"properties": {
"dimension": {
"type": "string"
},
"value": {
"default": null,
"anyOf": [
{
"type": "null",
"title": "All values"
},
{
"type": "number",
"minimum": 0,
"description": "See the `unit` parameter for more information."
},
{
"type": "string",
"subtype": "duration",
"description": "[ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations), e.g. `P1D` for one day.",
"pattern": "^(-?)P(?=\\d|T\\d)(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)([DW]))?(?:T(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+(?:\\.\\d+)?)S)?)?$"
}
]
},
"unit": {
"description": "The unit the values are given in, either in meters (`m`) or pixels (`px`). If no unit or `null` is given, uses the unit specified for the dimension or otherwise the default unit of the reference system.",
"default": null,
"anyOf": [
{
"title": "Default unit",
"type": "null"
},
{
"title": "Specific unit",
"type": "string",
"enum": [
"px",
"m"
]
}
]
}
}
}
}
},
{
"name": "overlap",
"description": "Overlap of neighborhoods along each dimension to avoid border effects. By default no overlap is provided.\n\nFor instance a temporal dimension can add 1 month before and after a neighborhood. In the spatial dimensions, this is often a number of pixels. The overlap specified is added before and after, so an overlap of 8 pixels will add 8 pixels on both sides of the window, so 16 in total.\n\nBe aware that large overlaps increase the need for computational resources and modifying overlapping data in subsequent operations have no effect.",
"optional": true,
"default": null,
"schema": [
{
"title": "Without overlap",
"type": "null"
},
{
"title": "With overlap",
"type": "array",
"items": {
"type": "object",
"subtype": "chunk-size",
"required": [
"dimension",
"value"
],
"properties": {
"dimension": {
"type": "string"
},
"value": {
"default": null,
"anyOf": [
{
"type": "null",
"title": "No values"
},
{
"type": "number",
"minimum": 0,
"description": "See the `unit` parameter for more information."
},
{
"type": "string",
"subtype": "duration",
"description": "[ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations), e.g. `P1D` for one day.",
"pattern": "^(-?)P(?=\\d|T\\d)(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)([DW]))?(?:T(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+(?:\\.\\d+)?)S)?)?$"
}
]
},
"unit": {
"description": "The unit the values are given in, either in meters (`m`) or pixels (`px`). If no unit or `null` is given, uses the unit specified for the dimension or otherwise the default unit of the reference system.",
"default": null,
"anyOf": [
{
"title": "Default unit",
"type": "null"
},
{
"title": "Specific unit",
"type": "string",
"enum": [
"px",
"m"
]
}
]
}
}
}
}
]
},
{
"name": "context",
"description": "Additional data to be passed to the process.",
"schema": {
"description": "Any data type."
},
"optional": true,
"default": null
}
],
"returns": {
"description": "A raster data cube with the newly computed values and the same dimensions. The dimension properties (name, type, labels, reference system and resolution) remain unchanged.",
"schema": {
"type": "object",
"subtype": "datacube",
"dimensions": [
{
"type": "spatial",
"axis": [
"x",
"y"
]
}
]
}
},
"examples": [
{
"arguments": {
"data": {
"from_parameter": "data"
},
"process": {
"process_graph": {
"udf": {
"process_id": "run_udf",
"arguments": {
"data": {
"from_parameter": "data"
},
"udf": "ml.py",
"runtime": "Python"
},
"result": true
}
}
},
"size": [
{
"dimension": "x",
"value": 128,
"unit": "px"
},
{
"dimension": "y",
"value": 128,
"unit": "px"
},
{
"dimension": "t",
"value": "P5D"
}
],
"overlap": [
{
"dimension": "x",
"value": 16,
"unit": "px"
},
{
"dimension": "y",
"value": 16,
"unit": "px"
},
{
"dimension": "t",
"value": "P3D"
}
]
}
}
],
"exceptions": {
"DimensionNotAvailable": {
"message": "A dimension with the specified name does not exist."
},
"DataCubePropertiesImmutable": {
"message": "The dimension properties (name, type, labels, reference system and resolution) must remain unchanged."
}
},
"links": [
{
"href": "https://openeo.org/documentation/1.0/datacubes.html#apply",
"rel": "about",
"title": "Apply explained in the openEO documentation"
}
]
}