forked from Open-EO/openeo-processes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rename_labels.json
175 lines (175 loc) · 7.01 KB
/
rename_labels.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
{
"id": "rename_labels",
"summary": "Rename dimension labels",
"description": "Renames the labels of the specified dimension in the data cube from `source` to `target`.\n\nIf the array for the source labels is empty (the default), the dimension labels are expected to be enumerated with zero-based numbering (0,1,2,3,...) so that the dimension labels directly map to the indices of the array specified for the parameter `target`. If the dimension labels are not enumerated and the `target` parameter is not specified, a `LabelsNotEnumerated` is thrown. The number of source and target labels must be equal, otherwise the error `LabelMismatch` is thrown.\n\nThis process doesn't change the order of the labels and their corresponding data.",
"categories": [
"cubes"
],
"parameters": [
{
"name": "data",
"description": "The data cube.",
"schema": {
"type": "object",
"subtype": "raster-cube"
}
},
{
"name": "dimension",
"description": "The name of the dimension to rename the labels for.",
"schema": {
"type": "string"
}
},
{
"name": "target",
"description": "The new names for the labels. The dimension labels in the data cube are expected to be enumerated, if the parameter `target` is not specified. If a target dimension label already exists in the data cube, a `LabelExists` error is thrown.",
"schema": {
"type": "array",
"items": {
"anyOf": [
{
"type": "number"
},
{
"type": "string"
}
]
}
}
},
{
"name": "source",
"description": "The names of the labels as they are currently in the data cube. The array defines an unsorted and potentially incomplete list of labels that should be renamed to the names available in the corresponding array elements in the parameter `target`. If one of the source dimension labels doesn't exist, a `LabelNotAvailable` error is thrown. By default, the array is empty so that the dimension labels in the data cube are expected to be enumerated.",
"schema": {
"type": "array",
"items": {
"anyOf": [
{
"type": "number"
},
{
"type": "string"
}
]
}
},
"default": [],
"optional": true
}
],
"returns": {
"description": "The data cube with the renamed labels. The old labels can not be referenced any longer.",
"schema": {
"type": "object",
"subtype": "raster-cube"
}
},
"exceptions": {
"LabelsNotEnumerated": {
"message": "The dimension labels are not enumerated."
},
"LabelMismatch": {
"message": "The number of labels in the parameters `source` and `target` don't match."
},
"LabelNotAvailable": {
"message": "A label with the specified name does not exist."
},
"LabelExists": {
"message": "A label with the specified name exists."
}
},
"examples": [
{
"title": "Rename named labels",
"description": "Renaming the bands from `B1` to `red`, from `B2` to `green` and from `B3` to `blue`. Doesn't rename the band `QA`.",
"process_graph": {
"loadco1": {
"process_id": "load_collection",
"arguments": {
"id": "S2-RGB",
"spatial_extent": null,
"temporal_extent": null,
"bands": [
"B1",
"B2",
"B3",
"QA"
]
}
},
"rename1": {
"process_id": "rename_labels",
"arguments": {
"data": {
"from_node": "loadco1"
},
"dimension": "bands",
"source": [
"B1",
"B2",
"B3"
],
"target": [
"red",
"green",
"blue"
]
},
"result": true
}
}
},
{
"title": "Rename enumerated labels",
"description": "The process replaces the temporal dimension with a new dimension `min_max` with enumerated labels. The first label refers to the minimum values, the second label refers to the maximum values. Afterwards, the dimension labels are renamed to `min` and `max` respectively.",
"process_graph": {
"loadco1": {
"process_id": "load_collection",
"arguments": {
"id": "S2-RGB",
"spatial_extent": null,
"temporal_extent": null
}
},
"apply1": {
"process_id": "apply_dimension",
"arguments": {
"data": {
"from_node": "loadco1"
},
"process": {
"process_graph": {
"extrem1": {
"process_id": "extrema",
"arguments": {
"data": {
"from_parameter": "data"
}
},
"result": true
}
}
},
"dimension": "t",
"target_dimension": "min_max"
}
},
"rename1": {
"process_id": "rename_labels",
"arguments": {
"data": {
"from_node": "apply1"
},
"dimension": "bands",
"target": [
"min",
"max"
]
},
"result": true
}
}
}
]
}