Skip to content

Commit

Permalink
Nasa DEM
Browse files Browse the repository at this point in the history
## Did you read the Contributor Guide?

- Yes, I have read [How to contribute](https://github.com/wri/cities-cif#How-to-contribute)

- No, I haven't read it.

## Is this PR related to a JIRA ticket?

- Yes, the URL of the associated JIRA ticket is https://gfw.atlassian.net/browse/CIF-XXX. The PR name follows the format `[CIF-XXX] my subject`.

- No, this is a documentation update. The PR name follows the format `[DOCS] my subject`.

## What changes were proposed in this PR?

## How was this patch tested?

## Did this PR include necessary documentation updates?

- Yes, I am adding a new API feature.
- Yes, I have updated the documentation update.
- No, this PR does not affect any public API so no need to change the docs.
  • Loading branch information
chrowe committed Jul 2, 2024
1 parent 6e3eb42 commit 30a057a
Show file tree
Hide file tree
Showing 2 changed files with 20 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 @@ -17,3 +17,4 @@
from .tree_canopy_height import TreeCanopyHeight
from .alos_dsm import AlosDSM
from .overture_buildings import OvertureBuildings
from .nasa_dem import NasaDEM
19 changes: 19 additions & 0 deletions city_metrix/layers/nasa_dem.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import ee
import xee
import xarray as xr
from city_metrix.layers.layer import Layer, get_image_collection

class NasaDEM(Layer):
def __init__(self, **kwargs):
super().__init__(**kwargs)

def get_data(self, bbox):
dataset = ee.Image("NASA/NASADEM_HGT/001")
nasa_dem = ee.ImageCollection(ee.ImageCollection(dataset)
.filterBounds(ee.Geometry.BBox(*bbox))
.select('elevation')
.mean()
)
data = get_image_collection(nasa_dem, bbox, 30, "NASA DEM").elevation

return data

0 comments on commit 30a057a

Please sign in to comment.