forked from sentinel-hub/custom-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
id_142.js
28 lines (24 loc) · 1.04 KB
/
id_142.js
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
//
// Chlorophyll Absorption Ratio Index (abbrv. CARI)
//
// General formula: (700nm/670nm)*(sqrt((a*670+670nm+b)^2))/((a^2+1)^0.5)
//
// URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=142
//
let index = (B05 / B04) * (Math.sqrt(Math.pow(((B05 - B03) / 150.0 * 670.0 + B04 + (B03 - ((B05 - B03) / 150.0 * 550.0))), 2.0))) / (Math.pow(((B05 - B03) / Math.pow(150.0, 2.0) + 1.0), 0.5));
let min = 0.018;
let max = 5.351;
// colorBlend will return a color when the index is between min and max and white when it is less than min.
// To see black when it is more than max, uncomment the last line of colorBlend.
// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range.
let underflow_color = [1, 1, 1];
let low_color = [208/255, 88/255, 126/255];
let high_color = [241/255, 234/255, 200/255];
let overflow_color = [0, 0, 0];
return colorBlend(index, [min, min, max],
[
underflow_color,
low_color,
high_color,
//overflow_color // uncomment to see overflows
]);