Skip to content

Commit 177b978

Browse files
committed
Add scene 0 (no Data) to SCL evaluation
1 parent 018f37e commit 177b978

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

R/waterscene_proportion.R

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,21 @@
1919
#' @export
2020
#'
2121
waterscene_proportion <- function(scl_image){
22-
scenes <- lapply(1:11, function(s) {
22+
scenes <- lapply(0:11, function(s) {
2323
Reduce("+", lapply(scl_image, function(image_scene){
2424
image_scene == s
2525
})) / length(scl_image)
2626
})
2727

28-
cloudsSnowTopography <-
29-
scenes[[7]] + scenes[[8]] + scenes[[9]] + scenes[[10]] +
30-
scenes[[11]] + scenes[[3]] + scenes[[2]]
28+
AllowedDisturbingScenes <- c(0, 2, 3, 7, 8, 9, 10, 11)
29+
30+
cloudsSnowTopography <- scenes[[AllowedDisturbingScenes[1] + 1]]
31+
for(s in AllowedDisturbingScenes[-1]){
32+
cloudsSnowTopography <- cloudsSnowTopography + scenes[[s+1]]
33+
}
34+
3135
# The proportion of water pixels after removing clouds and snow or ice
32-
water <- scenes[[6]] / (1 - cloudsSnowTopography)
36+
water <- scenes[[6+1]] / (1 - cloudsSnowTopography)
3337

3438
list("water" = water,
3539
"NoFalseDisturbance" = cloudsSnowTopography,

0 commit comments

Comments
 (0)