import topotoolbox
import numpy as np
import matplotlib.pyplot as plt
dem = topotoolbox.load_dem('perfectworld')
fd = topotoolbox.FlowObject(dem)
s = topotoolbox.StreamObject(fd,threshold=1000,units='pixels')
confluences = s.streampoi('confluences')
s2 = s.downstreamto(confluences)
fig,ax = plt.subplots()
_= dem.plot(ax=ax,cmap="terrain")
_= s2.plot(ax=ax,color='k')
plt.show()
