forked from Open-EO/openeo-processes
-
Notifications
You must be signed in to change notification settings - Fork 4
/
linear_scale_range.json
169 lines (169 loc) · 4.89 KB
/
linear_scale_range.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
{
"id": "linear_scale_range",
"summary": "Linear transformation between two ranges",
"description": "Performs a linear transformation between the input and output range.\n\nThe given number in `x` is clipped to the bounds specified in `inputMin` and `inputMax` so that the underlying formula *`((x - inputMin) / (inputMax - inputMin)) * (outputMax - outputMin) + outputMin`* never returns any value lower than `outputMin` or greater than `outputMax`.\n\nPotential use case include\n\n* scaling values to the 8-bit range (0 - 255) often used for numeric representation of values in one of the channels of the [RGB colour model](https://en.wikipedia.org/wiki/RGB_color_model#Numeric_representations) or\n* calculating percentages (0 - 100).\n\nThe no-data value `null` is passed through and therefore gets propagated.",
"categories": [
"math"
],
"parameters": [
{
"name": "x",
"description": "A number to transform. The number gets clipped to the bounds specified in `inputMin` and `inputMax`.",
"schema": {
"type": [
"number",
"null"
]
}
},
{
"name": "inputMin",
"description": "Minimum value the input can obtain.",
"schema": {
"type": "number"
}
},
{
"name": "inputMax",
"description": "Maximum value the input can obtain.",
"schema": {
"type": "number"
}
},
{
"name": "outputMin",
"description": "Minimum value of the desired output range.",
"schema": {
"type": "number"
},
"default": 0,
"optional": true
},
{
"name": "outputMax",
"description": "Maximum value of the desired output range.",
"schema": {
"type": "number"
},
"default": 1,
"optional": true
}
],
"returns": {
"description": "The transformed number.",
"schema": {
"type": [
"number",
"null"
]
}
},
"examples": [
{
"arguments": {
"x": 0.3,
"inputMin": -1,
"inputMax": 1,
"outputMin": 0,
"outputMax": 255
},
"returns": 165.75
},
{
"arguments": {
"x": 25.5,
"inputMin": 0,
"inputMax": 255
},
"returns": 0.1
},
{
"arguments": {
"x": null,
"inputMin": 0,
"inputMax": 100
},
"returns": null
},
{
"description": "Shows that the input data is clipped.",
"arguments": {
"x": 1.12,
"inputMin": 0,
"inputMax": 1,
"outputMin": 0,
"outputMax": 255
},
"returns": 255
}
],
"process_graph": {
"subtract1": {
"process_id": "subtract",
"arguments": {
"x": {
"from_parameter": "x"
},
"y": {
"from_parameter": "inputMin"
}
}
},
"subtract2": {
"process_id": "subtract",
"arguments": {
"x": {
"from_parameter": "inputMax"
},
"y": {
"from_parameter": "inputMin"
}
}
},
"subtract3": {
"process_id": "subtract",
"arguments": {
"x": {
"from_parameter": "outputMax"
},
"y": {
"from_parameter": "outputMin"
}
}
},
"divide": {
"process_id": "divide",
"arguments": {
"x": {
"from_node": "subtract1"
},
"y": {
"from_node": "subtract2"
}
}
},
"multiply": {
"process_id": "multiply",
"arguments": {
"x": {
"from_node": "divide"
},
"y": {
"from_node": "subtract3"
}
}
},
"add": {
"process_id": "add",
"arguments": {
"x": {
"from_node": "multiply"
},
"y": {
"from_parameter": "outputMin"
}
},
"result": true
}
}
}