diff --git a/city_metrix/layers/tree_cover.py b/city_metrix/layers/tree_cover.py index e5e89c4..fadc9bb 100644 --- a/city_metrix/layers/tree_cover.py +++ b/city_metrix/layers/tree_cover.py @@ -13,9 +13,10 @@ class TreeCover(Layer): NO_DATA_VALUE = 255 - def __init__(self, min_tree_cover=None, **kwargs): + def __init__(self, min_tree_cover=None, max_tree_cover=None, **kwargs): super().__init__(**kwargs) self.min_tree_cover = min_tree_cover + self.max_tree_cover = max_tree_cover def get_data(self, bbox): tropics = ee.ImageCollection('projects/wri-datalab/TropicalTreeCover') @@ -27,6 +28,8 @@ def get_data(self, bbox): if self.min_tree_cover is not None: data = data.where(data >= self.min_tree_cover) + if self.max_tree_cover is not None: + data = data.where(data <= self.max_tree_cover) return data