forked from TopoToolbox/pytopotoolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supply boundary conditions to fillsinks and handle NaNs properly (Top…
…oToolbox#70) Resolves TopoToolbox#69. CMakeLists.txt: Set GIT_TAG to main to access the new boundary conditions API in libtopotoolbox. This should be changed to 2024-W43 before this is merged but after the next weekly release of libtopotoolbox src/lib/grid.cpp: `wrap_fillsinks` adds a `bc` argument, which it supplies to libtopotoolbox's `fillsinks` directly. src/topotoolbox/grid_object.py: The boundary conditions are supplied to `GridObject.fillsinks` as an optional argument. If `bc` is not supplied, then the default is to fix the DEM to its value on the exterior and fill all interior pixels that are not NaNs. NaNs are treated as if they were known sinks by temporarily setting the DEM to -infinity and fixing that pixel as if it were a boundary pixel. If the user passes in their own boundary condition array, we assume that they have already handled NaNs according to their own preferences, and we do not treat them in any particular way. src/topotoolbox/flow_object.py adds the same boundary condition logic as in `GridObjects.fillsinks`. The user can optionally pass a `bc` parameter to the `FlowObject` constructor. We could use this in the future to implement more complex controls on flow routing, so I am not too worried about adding an extra optional argument here. This has been informally tested against the TopoToolbox snapshot tests, but those have not yet been implemented in pytopotoolbox.
- Loading branch information
Showing
4 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters