mdbartos / pysheds

:earth_americas: Simple and fast watershed delineation in python.
GNU General Public License v3.0
702 stars 188 forks source link

HAND Spatial extent different from DEM for large DEMs #208

Open AlvaroProsperia opened 1 year ago

AlvaroProsperia commented 1 year ago

I have noticed that when running the HAND analysis using pysheds, the spatial extent of the hand analysis is different to that of the input DEM in some cases (I haven't identified a pattern yet).

The issue happens after clipping the grid object as follows:

Delineate a catchment

catch = grid.catchment(x=x, y=y, fdir=fdir, xytype='coordinate')

Clip to the catchment

grid.clip_to(catch)

It seems to corrupt the grid object. I have ran the same code on other DEMs without issues, but for some reason this comes up occasionally.

Here is an image to illustrate:

image

The HAND map has the issue of assigning values to pixels that are outside of the original DEM. Both coordinate systems are the same.

Not sure if there is something wrong that I am doing, any guidance would be helpful. I have attached a DEM with this same issue

HYBAS_DEM_7060053250.zip