mdbartos / pysheds

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

Accumulation disconnections #247

Closed mirouml closed 4 months ago

mirouml commented 4 months ago

chrome_NjixM5Cqwt

First thank you for awesome pysheds. I have a question, even though I am running:

    # Fill pits in DEM
    pit_filled_dem_grid = grid.fill_pits(dem)
    # Fill depressions in DEM
    flooded_dem_grid = grid.fill_depressions(pit_filled_dem_grid)
    # Resolve flats in DEM
    inflated_dem_grid = grid.resolve_flats(flooded_dem_grid)

I am still getting a lot of disconnections in accumulation (as pictured). DEM looks well treated with no visible problem, there is a clear path for the flow (though looking flat), but accumulation just stops for no obvious reason comparing to other locations which look completely same.

Is this a bug or something I can resolve by setting some parameters etc.?

mdbartos commented 4 months ago

I believe this may be related to #239

@groutr recently contributed a fix: #243

I can create a new release with this change, but until then try installing from the github repo

Btw, what are you using to visualize?

mirouml commented 4 months ago

Thank you for the fast answer. I am not sure I am doing this right. I did:

pip install git+https://github.com/mdbartos/pysheds.git

Resolves to:

Resolved https://github.com/mdbartos/pysheds.git to commit 727c5216e4b00a6d96fe1823652945fa06dafaa3

This way I do not see any change after running script again.

For visualization I use ArcGIS Maps SDK for JavaScript (https://developers.arcgis.com/javascript/latest/) running in browser. There are a few steps and tweaks to achieve it though. All grids needs to be Cloud Optimized GeoTIFF (COG). Using SceneView class to display in 3D, for ground BaseElevationLayer class needs to be subclassed and tweaked etc.

mdbartos commented 4 months ago

Hmm, when running resolve_flats, try using a smaller epsilon value i.e. resolve_flats(..., eps=1e-8) or smaller. Let me know if that changes anything.

mirouml commented 4 months ago

Hmm, when running resolve_flats, try using a smaller epsilon value i.e. resolve_flats(..., eps=1e-8) or smaller. Let me know if that changes anything.

Thank you very much. Yes, that did the trick. Can't see any disconnections anymore. Perfect!