From 86cda0c1c7009e7fda2ae36e811aa4c3bd6983bf Mon Sep 17 00:00:00 2001 From: Kenn Cartier Date: Wed, 18 Dec 2024 23:04:54 -0800 Subject: [PATCH] further testing processing error --- city_metrix/layers/nasa_dem.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/city_metrix/layers/nasa_dem.py b/city_metrix/layers/nasa_dem.py index d937129..72623a9 100644 --- a/city_metrix/layers/nasa_dem.py +++ b/city_metrix/layers/nasa_dem.py @@ -1,6 +1,4 @@ import ee -import xee -import xarray as xr from .layer import Layer, get_image_collection @@ -16,12 +14,20 @@ def __init__(self, spatial_resolution=30, **kwargs): self.spatial_resolution = spatial_resolution 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, self.spatial_resolution, "NASA DEM").elevation - - return data \ No newline at end of file + nasa_dem = ee.Image("NASA/NASADEM_HGT/001") + + nasa_dem_elev = (ee.ImageCollection(nasa_dem) + .filterBounds(ee.Geometry.BBox(*bbox)) + .select('elevation') + .mean() + ) + + nasa_dem_elev_ic = ee.ImageCollection(nasa_dem_elev) + data = get_image_collection( + nasa_dem_elev_ic, + bbox, + self.spatial_resolution, + "NASA DEM" + ).elevation + + return data