xarray-spatial icon indicating copy to clipboard operation
xarray-spatial copied to clipboard

Cannot display hillshade as 3D map

Open bidhya opened this issue 4 years ago • 4 comments

I am looking at example 1_Surface.ipynb . The following line of code only shows the 2D image. The lower part of the image show how the plot should look.

I observed similar issue when running 8_Remote_Sensing.ipynb example for bump mapping

Environment: Python 3.8 (windows 10 and linux) xarray-spatial 0.1.2 conda-forge xarray 0.16.2 conda-forge datashader 0.12.0 conda-forge

from xrspatial import hillshade

illuminated = hillshade(terrain, angle_altitude=100)
shade(illuminated, cmap=['gray', 'white'], alpha=255, how='linear')

image

bidhya avatar Jan 29 '21 20:01 bidhya

@bidhya hey thanks for the report...taking a look now...

brendancol avatar Feb 03 '21 16:02 brendancol

Hey guys... I've just checked the hillshade function return, and it's supposedly a 2D DataArray. I'm not quite sure, but to have a 3D image we'd need to use a 3D array at the shade function from Datashader, so I don't think it would work given the current returned data.

dericksm avatar Oct 28 '21 01:10 dericksm

@dericksm datashder to my knowledge doesn't handle 3D arrays for shading unless they are categorical arrays generated by datashader's count_cat aggregate function. Right now hillshade expects 2D arrays and outputs 2D arrays.

brendancol avatar Oct 28 '21 13:10 brendancol

@dericksm datashder to my knowledge doesn't handle 3D arrays for shading unless they are categorical arrays generated by datashader's count_cat aggregate function. Right now hillshade expects 2D arrays and outputs 2D arrays.

@brendancol, you know that I'm not too familiar with all this, but for what I've searched, I think you're right, but the point is that in the Hillshade example from xarray-spatial it says:

Applying hillshade reveals a lot of detail in the 3D shape of the terrain.

I think this is why @bidhya opened this issue.

dericksm avatar Oct 29 '21 01:10 dericksm