Skip to content

Instantly share code, notes, and snippets.

@twei55
Last active March 15, 2023 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twei55/09efd83177bdcb9fbf61ad46b8291612 to your computer and use it in GitHub Desktop.
Save twei55/09efd83177bdcb9fbf61ad46b8291612 to your computer and use it in GitHub Desktop.
Custom script to calculate FDI (Floating Debris Index) in EO-Browser (Advanced version)
/*
Calculation of Floating Debris Index (FDI)
For more information see https://www.nature.com/articles/s41598-020-62298-z
*/
// S-2A Central Wavelength (nm)
const waveLengthRed = 664.6
const waveLengthNIR = 832.8
const waveLengthSWIR = 1613.7
const FDI = B08 - (B06 + (B11 - B06) * ((waveLengthNIR - waveLengthRed)/(waveLengthSWIR - waveLengthRed)) * 10)
// https://docs.sentinel-hub.com/api/latest/evalscript/functions/#index
// Calculate difference divided by sum
const NDVI = index(B08, B04)
const FDIMask = 0.02 > FDI < 0.07
const NDVIMask = 0.01 > NDVI < 0.25
return [FDIMask * NDVIMask]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment