Skip to content

Commit

Permalink
clean up tree cover loss logic and comment
Browse files Browse the repository at this point in the history
  • Loading branch information
solomon-negusse committed Nov 1, 2024
1 parent 78af193 commit 32857c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 0 additions & 2 deletions app/routes/titiler/algorithms/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class Alerts(BaseAlgorithm):
title: str = "Deforestation Alerts"
description: str = "Decode and visualize alerts"


conf_colors: OrderedDict = OrderedDict(
{
IntegratedAlertConfidence.low: AlertConfig(
Expand All @@ -33,7 +32,6 @@ class Alerts(BaseAlgorithm):
}
)


record_start_date: str = "2014-12-31"

start_date: Optional[str] = None
Expand Down
14 changes: 7 additions & 7 deletions app/routes/titiler/algorithms/dist_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ def create_mask(self):
)

if self.tree_cover_loss_mask:
# Tree cover loss before 2020 can't be used to filter out pixels as not forest
# if they had tree cover loss. Instead we use tree cover height taken that year
# is used as source of truth.
# Tree cover loss data before 2020 can't be used to filter out pixels as not forest
# if they had tree cover loss. Instead, we use tree cover height taken that
# year as source of truth. For example, if a pixel had tree cover loss on
# 2018, but has tree cover height (2020) that meets the forest threshold, the pixel meets
# the forest criteria for alerts.
mask *= (
(self.tree_cover_loss_data.array[0, :, :] >= self.tree_cover_loss_mask)
| (self.tree_cover_loss_data.array[0, :, :] == 0)
| (self.tree_cover_loss_data.array[0, :, :] <= 2020)
)
self.tree_cover_loss_data.array[0, :, :] >= self.tree_cover_loss_mask
) | (self.tree_cover_loss_data.array[0, :, :] <= 2020)

return mask

0 comments on commit 32857c6

Please sign in to comment.