Skip to content

Commit

Permalink
add TreeCanopyHeight function
Browse files Browse the repository at this point in the history
  • Loading branch information
chrowe authored May 29, 2024
1 parent 2f4fdb1 commit e33f688
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions city_metrix/layers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
from .built_up_height import BuiltUpHeight
from .average_net_building_height import AverageNetBuildingHeight
from .open_buildings import OpenBuildings
from .tree_canopy_hight import TreeCanopyHeight
29 changes: 29 additions & 0 deletions city_metrix/layers/tree_canopy_hight.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from .layer import Layer, get_utm_zone_epsg, get_image_collection

from dask.diagnostics import ProgressBar
import xarray as xr
import xee
import ee


class TreeCanopyHeight(Layer):

name = "tree_canopy_hight"

NO_DATA_VALUE = 0

def __init__(self, **kwargs):
super().__init__(**kwargs)

def get_data(self, bbox):
canopy_ht = ee.ImageCollection("projects/meta-forest-monitoring-okw37/assets/CanopyHeight")
# aggregate time series into a single image
canopy_ht = canopy_ht.reduce(ee.Reducer.mean()).rename("cover_code")




data = get_image_collection(ee.ImageCollection(canopy_ht), bbox, 1, "tree canopy hight")

return data.cover_code

0 comments on commit e33f688

Please sign in to comment.