Retrieving values from DEM data #134
-
Hi there,
I am getting error "No numeric data to plot." When I run da.plot(), and the shape of I am wondering if I am gathering the data incorrectly. Any help would be appreciated, Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
jdbcode
Dec 17, 2024
Replies: 1 comment
-
There are two things going wrong here:
The solution in your case is to move the rectangle to a region that has data and to provide the dem = ee.Image('USGS/3DEP/10m').select('elevation')
dem_ic = ee.ImageCollection(dem)
rect = ee.Geometry.Rectangle(-124.0302, 42.8196, -123.9258, 42.9243)
proj = dem_ic.first().select(0).projection().getInfo()
ds = xr.open_dataset(
dem_ic,
engine='ee',
geometry=rect,
crs=proj['crs'],
scale=proj['transform'][0],
)
da = ds['elevation']
display(da)
da.plot() |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jdbcode
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are two things going wrong here:
crs
andscale
, which are 'EPSG:4326' and 1 degree, respectively. And, with the small rectangle you've defined, it only interests a single 1-degree pixel. So, you only get 1 value returned, which can't be plotted with.plot()
.The solution in your case is to move the rectangle to a region that has data and to provide the
crs
andscale
parameters based on the dataset. For example: