-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PlanetScope NDVI: update script.js * PlanetScope NDVI: add eob.js * PlanetScope NDVI: add raw.js * PlanetScope NDVI: add scripts to readme.md * improve eob script for skysat * improve raw script for skysat * improve default script for skysat
- Loading branch information
Showing
4 changed files
with
82 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//VERSION=3 | ||
// NDVI | ||
|
||
function setup() { | ||
return { | ||
input: ["Red", "NIR", "dataMask"], | ||
output: [ | ||
{ id: "default", bands: 4 }, | ||
{ id: "index", bands: 1, sampleType: "FLOAT32" }, | ||
{ id: "eobrowserStats", bands: 2, sampleType: "FLOAT32" }, | ||
{ id: "dataMask", bands: 1 }, | ||
] | ||
} | ||
} | ||
|
||
function evaluatePixel(sample) { | ||
let NDVI = index(sample.NIR, sample.Red); | ||
const indexVal = isFinite(NDVI) && sample.dataMask === 1 ? NDVI : NaN; | ||
let id_default = valueInterpolate(NDVI, | ||
[0, 0.2, 0.3, 0.4, 0.5, 1.0], | ||
[ | ||
[1, 1, 0.88], | ||
[0.57, 0.75, 0.32], | ||
[0.44, 0.64, 0.25], | ||
[0.31, 0.54, 0.18], | ||
[0.19, 0.43, 0.11], | ||
[0.06, 0.33, 0.04], | ||
[0, 0.27, 0], | ||
] | ||
); | ||
|
||
return { | ||
default: [...id_default, sample.dataMask], | ||
index: [indexVal], | ||
eobrowserStats: [indexVal, sample.dataMask], | ||
dataMask: [sample.dataMask], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//VERSION=3 | ||
// NDVI | ||
|
||
function setup() { | ||
return { | ||
input: ["Red", "NIR"], | ||
output: [ | ||
{ id: "default", bands: 1 }, | ||
] | ||
} | ||
} | ||
|
||
function evaluatePixel(sample) { | ||
let NDVI = index(sample.NIR, sample.Red); | ||
return { default: [NDVI] }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,30 @@ | ||
//VERSION=3 | ||
// NDVI | ||
|
||
function setup() { | ||
return { | ||
input: ["red", "nir", "dataMask"], | ||
output: { bands: 4 } | ||
input: ["Red", "NIR", "dataMask"], | ||
output: [ | ||
{ id: "default", bands: 4 }, | ||
] | ||
} | ||
} | ||
var f = 10000 | ||
|
||
function evaluatePixel(sample) { | ||
var NDVI = index(sample.nir, sample.red) | ||
return valueInterpolate(NDVI, | ||
let NDVI = index(sample.NIR, sample.Red); | ||
let id_default = valueInterpolate(NDVI, | ||
[0, 0.2, 0.3, 0.4, 0.5, 1.0], | ||
[ | ||
[1, 1, 0.88, sample.dataMask], | ||
[0.57, 0.75, 0.32, sample.dataMask], | ||
[0.44, 0.64, 0.25, sample.dataMask], | ||
[0.31, 0.54, 0.18, sample.dataMask], | ||
[0.19, 0.43, 0.11, sample.dataMask], | ||
[0.06, 0.33, 0.04, sample.dataMask], | ||
[0, 0.27, 0, sample.dataMask], | ||
]) | ||
[1, 1, 0.88], | ||
[0.57, 0.75, 0.32], | ||
[0.44, 0.64, 0.25], | ||
[0.31, 0.54, 0.18], | ||
[0.19, 0.43, 0.11], | ||
[0.06, 0.33, 0.04], | ||
[0, 0.27, 0], | ||
]); | ||
|
||
return { | ||
default: [...id_default, sample.dataMask], | ||
}; | ||
} |