mirror of
https://github.com/noerw/sentinel_fire
synced 2025-07-13 03:00:22 +02:00

added water detection and water will be deleted in dNBR and BAIS2 scripts also changed bands to correct ones -> needs testing
27 lines
572 B
R
27 lines
572 B
R
#rm(list=ls())
|
|
|
|
|
|
# ------------------------ Libraries ------------------------
|
|
|
|
library(raster)
|
|
|
|
# ------------------------ Function definition ------------------------
|
|
deleteWater <- function(Image,water){
|
|
|
|
# ------------------------ Loading Bands ------------------------
|
|
##
|
|
burnedArea <- Image
|
|
water <- water
|
|
|
|
|
|
# Bands
|
|
water <- reclassify(water, c( -Inf , 0, 0,
|
|
0 , Inf , 1 ))
|
|
|
|
output <- burnedArea
|
|
output[water == 1] <- NA
|
|
|
|
# ------------------------ Output ------------------------ #
|
|
return(output)
|
|
}
|
|
|