Skip to content

Add GraphFlood example#343

Open
wkearn wants to merge 1 commit intoTopoToolbox:mainfrom
wkearn:graphflood-example
Open

Add GraphFlood example#343
wkearn wants to merge 1 commit intoTopoToolbox:mainfrom
wkearn:graphflood-example

Conversation

@wkearn
Copy link
Copy Markdown
Member

@wkearn wkearn commented Aug 14, 2025

This adds a Jupyter notebook that runs GraphFlood on the Green River DEM as in Gailleton et al. (2024). This generates the figure that is planned for the TT3 manuscript.

@bgailleton: Any ideas for improving this example?

This adds a Jupyter notebook that runs GraphFlood on the Green River
DEM as in Gailleton et al. (2024). This generates the figure that is
planned for the TT3 manuscript.
@wkearn wkearn added the documentation Improvements or additions to documentation label Aug 14, 2025
@bgailleton
Copy link
Copy Markdown
Contributor

@wkearn I have two main suggestions. First it can be interesting to have a bit more outputs than just the flow depth, for example flow velocity or discharge or eventually other component that would demonstrate the advantage of using both graphflood integrated into topotoolbox.
Q and u are not directly calculable with the run_graphflood method. I am thinking of completing the interface of graphflood on pytopotoolbox with a Object Oriented interface to facilitate the use, for example

gfo = GraphFloodObject(...)
gfo.run(N_iterations)
gfo.get_Qin()
gfo.run(N_more_iterations)
gfo.get_u()
...

Second suggestion, I do not mind using green_river, but as it has already been used in the 2024 paper, maybe another field site would bring more demo?

let me know your thoughts.

@bgailleton
Copy link
Copy Markdown
Contributor

bgailleton commented Sep 22, 2025

#344 added the graphflood Object and paves the way to the example (sorry for the delay)

I hope to get time to do this, but at least for now you can get a bunch of new metrics.

here is a minimal example:

import numpy as np
import topotoolbox as ttb
import matplotlib.pyplot as plt

# dem =ttb.read_tif('exampleDEM.txt')
dem = ttb.load_dem('bigtujunga')
dem = dem.fillsinks()
gfo = ttb.GFObject(dem, p=1e-4, manning=0.033)
gfo.run_n_iterations(dt=1e-1, n_iterations=200)

# Plot relevant flow depth
fig,ax = plt.subplots()
ax.imshow(dem.hillshade(), cmap = 'gray')
thw = gfo.hw.z
thw[thw < 1e-2] = np.nan

ax.imshow(thw, cmap = 'Blues')

# Getter to other metrics:
gfo.qvol_i # Discharge accumulated via drainage area (non local)
gfo.qvol_o # Local discharge calculated from manning's
gfo.sw # Hydraulic slope 
gfo.u # flow velocity
gfo.compute_tau() # Computes river basal shear stress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants