mdbartos/pysheds

Can't 'imshow' DEM for some unkown reason

Opened this issue · 1 comments

Hi,

When using the following code:

fig, ax = plt.subplots(figsize=(8,6)) plt.imshow(grid.dem, extent=grid.extent, cmap='cubehelix', zorder=1) plt.colorbar(label='Elevation (m)') plt.title('Digital elevation map') plt.xlabel('Longitude') plt.ylabel('Latitude')

I get the following error:

AttributeError: 'sGrid' object has no attribute 'dem'

Even though I did use grid = Grid.from_raster('.../example/dem.tif')

Any thoughts on this issue?

Thanks!
R.

The grid doesn't store the DEM, you have to load it separately using
dem = grid.read_raster('.../example/dem.tif')