forked from Open-EO/openeo-processes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linear_scale_range.json
86 lines (86 loc) · 2.63 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
{
"id": "linear_scale_range",
"summary": "Linear transformation between two ranges",
"description": "Performs a linear transformation between the input and output range.\n\nThe underlying formula is: `((x - inputMin) / (inputMax - inputMin)) * (outputMax - outputMin) + outputMin`.\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"
],
"parameter_order": ["x", "inputMin", "inputMax", "outputMin", "outputMax"],
"parameters": {
"x": {
"description": "A number to transform.",
"schema": {
"type": [
"number",
"null"
]
},
"required": true
},
"inputMin": {
"description": "Minimum value the input can obtain.",
"schema": {
"type": "number"
},
"required": true
},
"inputMax": {
"description": "Maximum value the input can obtain.",
"schema": {
"type": "number"
},
"required": true
},
"outputMin": {
"description": "Minimum value of the desired output range.",
"schema": {
"type": "number",
"default": 0
}
},
"outputMax": {
"description": "Maximum value of the desired output range.",
"schema": {
"type": "number",
"default": 1
}
}
},
"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
}
]
}