EGU WEBINARS: Topographic Analysis Using TopoToolbox in MATLAB And Python - Session 1
Watch on YouTubeVideo summary
This two-day EGU webinar series introduces TopoToolbox version 3, a powerful platform designed for model-based terrain analysis in both MATLAB and Python environments. Hosted by a dedicated team including Boris, Will, Bastian, and D, the sessions aim to showcase new functionalities, encourage community contributions, and unite the geomorphology community. The core philosophy of TopoToolbox distinguishes it from standard GIS tools by focusing on scientific models, such as stream power incision, while offering the flexibility for custom workflows and algorithm prototyping. Developed with DFG funding, version 3 adheres to FAIR principles to ensure data is findable, accessible, interoperable, and reusable, while maintaining backward compatibility with version 2 through a core C library that supports multiple programming languages.
The technical demonstrations highlight significant capabilities in terrain analysis, including DEM loading, reprojection, stream network derivation, nickpoint detection, and Kain analysis. In the Python implementation via PyTopoToolbox, users can perform equivalent analyses to the MATLAB version, though they must adapt to differences in function naming conventions and object-oriented syntax. For instance, flow accumulation is handled differently, and visualization often relies on scatter plots rather than dedicated color-plotting functions for streams. The session also addresses specific limitations, such as the current absence of certain grid-based tools like `largest_inscribed_grid` in Python, while emphasizing that feature parity across languages is not the primary goal; instead, the focus remains on providing essential tools for scientific inquiry where users are encouraged to open issues for missing functions.
Practical considerations regarding data resolution and model application were central to the discussion, particularly concerning tools like GraphFlood and Bankfull Mapper which require sufficient detail to represent river banks effectively. The webinar explained the Stream Power Incision Model and the Kain transformation, noting that nickpoints cluster in Kain space following a base-level drop, allowing for the estimation of model parameters through optimization to simulate evolutionary processes. To ensure accurate results in steep terrains or noisy data, speakers recommended using smoothing functions to filter out natural variability and DEM errors, and advised setting nickpoint tolerance thresholds that exceed maximum DEM error levels. Users upgrading from version 2 were also warned about potential structural changes affecting existing grid or flow objects, with exporting DEMs to TIFF and re-importing suggested as a mitigation strategy.
The session concluded with a strong emphasis on community engagement and support channels, directing users to GitHub for bug reports and scientific discussions while noting that the blog is being migrated to a gallery. A significant portion of the Q&A addressed technical queries regarding LiDARtopper's current lack of scale-dependent analysis capabilities and the manual steps required to analyze DEM differences without dedicated functions. The organizers highlighted that over 40% of attendees expressed interest in contributing to the project, reinforcing the webinar's goal of fostering broader involvement through hackathons, courses, and the TopoToolbox Gallery. Ultimately, the event served as a comprehensive guide for geomorphologists looking to leverage advanced topographic analysis tools while actively participating in the ongoing development of an open-source scientific ecosystem.
Read the full video transcript
Welcome everybody. Um I'm really amazed
to see that many participants which is
great. Um so welcome everybody and good
afternoon to those who are in Europe I
guess in Africa. Good evening or good
night to those in Asia and good morning
to those in in the US. So I think we
probably have people from all over the
world. um which once again underlines uh
how cool it is to to have this webinar
um so that people can uh participate uh
globally. So this webinar uh is hosted
by EGU. So thanks foremost to the
European Geoscience Union uh for um
hosting us and and giving us the
opportunity to give this webinar about
topographic analysis using topo toolbox
in MATLAB and Python. So just to check
in and to see um whether you have
actually participated in the right
webinar, here are a couple of questions
that you might ask yourself. And if you
can answer any of those with yes or you
can even answer all of them with a yes,
you're completely right here. So do you
want to develop your skills in
topographic analysis? Do you want to
learn how to address scientific problems
by using Toper Toolbox? Do you want to
discover new functionalities in Toper
Toolbox 3? in MATLAB and Python. Do you
want to learn from examples of advanced
terrain analysis? And finally, and
perhaps also most important, do you want
to know how to contribute to the
development of top toolbox? As I said,
if you say yes here, uh you are more
than welcome and you are completely
right. What are you going to see in this
webinar? Um well, what we are going to
do is that we'll present new
functionalities in top of toolbox. We'll
show how one can contribute irrespective
of programming language and programming
skills. And we also want to know from
you how you might want to contribute and
uh at the end I think this should be
also taken as a great opportunity to
bring the international geomorphology
community together. Now, I've mentioned
quite a few times the word we. Here's a
small gallery of who has actually
instigated and uh who's now leading uh
this little webinar. Um the names were
just here before, but Boris, there's me,
Will, Bastian, and D. Okay. So, what are
you going to expect in that webinar
which is going to last 2 days. So we
have a session today which goes from 4
to 6 PM central European summer time. Um
today we will briefly introduce the
webinar aims and scopes. That's what I'm
doing right now. Uh then we will have an
introduction to topolbox in MATLAB. Then
we will see how we can do similar stuff
or actually the same stuff using Python.
And then we will have some time for
answering questions and answers. Um I'll
get back to that just in a second. And
then we will have or we will cover a bit
of a more advanced topic which is about
modeling nickpoint locations using top
toolbox in MATLAB. Um at the end of
today's session we will talk about the
future of top toolbox. Then on the
second day, so tomorrow again from 4 to
6:00 p.m. Central European summer time,
we will briefly recap on what we have
done today or yesterday in that case. Um
and then Boris will give an introduction
to graphlet which is a simplified
hydrodnamics toolbox in top of toolbox
or software in top toolbox. Um Bastia
will talk about transact which is also a
kind of add-on uh to interlink different
landforms and analyze them. Um then
we'll will show um how to contribute to
top toolbox. So give an introduction how
you can actually do that and then again
we will have a discussion and then
finally conclude that webinar. So this
is what you're going to expect in the
next two days. So this webinar is about
topographic analysis and know one of the
main questions is why do we actually
want to do terrain analysis and why and
and what is the role of toper toolbox
here. Well very simple and very general
we could say that we want to understand
how the earth system works or even that
of other planets and topography gives us
many clues about it. So for example,
think of the dynamics of tectonic faults
or perhaps sea level changes. These
changes uh leave an imprint on the river
network and in topography. That's
something that we can infer then from
river networks data. Think of landslides
and the occurrence of landslides.
Topography is a first order yeah
predictor to or that helps us to predict
where landslides occur. So in the end
also many models and simulations rely on
topographic data uh think of hydrodnamic
models, hydraological models um and some
of these models require pre-processing.
All that is done using topographic
software. The other incentive to work
with terrain analysis is that terrain
data has become really ab abundant in
the last years. Not everywhere but in
many countries of the world we now have
lighter data for example and we have
never had as much and as detailed
topographic data as we have today. So
there's a good incentive to harness that
data to learn more about how the earth
system works. Now top toolbox is a
software that should support that
process. Okay. And perhaps some of you
might ask, well, we have GIS for that.
And of course, there are a lot of, you
know, yeah, overlappingings between what
topo toolbox can do as a terrain
analysis software and what you can do in
GIS. But I think one of the main
distinctions is that top toolbox is
centered around a model based approach
to the analysis of DMS. So we think in
terms of or often things in terms of
models like the stream power incision
model um that guide our analysis and
that guide our statistical or machine
learning workflows that we use. Um top
of toolbox is also at least if you can
do some programming and I hope you can
um otherwise I encourage you to learn
that um is for prototyping new
algorithms and workflows. So you're in a
relatively easy space, let's say, where
you can develop your own stuff and try
it out. Finally, toolbox is also a nice
way to visualize DMs and uh any related
results that have something to do with
terrain analysis. So for these purposes,
Topo Toolbox has served the community as
a MATLAB based software for now for uh
15 years. That's quite a while. So,
we're quite proud to now introduce um
let's say the the latest version, Topo
Toolbox 3. Okay. Um so we were lucky to
receive funding from the German Research
Foundation which I really like to
acknowledge here also uh and and thank
you for that uh for that funding um for
conducting a a project which was called
topper toolbox 3 improving the quality
and reuse of research software for
terrain analysis. Um the main aims of
the project were to bring Topopper T
toolbox to a stage where it is fair.
Okay, fair in the software sense. Um so
following the fair principles, it should
be findable, it should be accessible,
interoperable and reusable and well one
of the main aims was here with to make
it also available in other programming
languages like Python and R. and also to
more involve the community in developing
and maintaining topper toolbox um to
make Topo Toolbox um a sustainable
software for the decade to come. Okay.
So for top toolbox users who have used
the MATLAB version 2 uh which has been
around for now 10 years or so even
longer um if you have already switched
to top toolbox 3 you might not notice
many differences. Okay, that exactly was
our aim to keep that backward
compatibility. But you might have
noticed or not um that there had been
happening a lot under the hood. Okay.
So, Will Kier who's here today also um
is uh was or put a lot of effort into
you know rewriting parts of the core
algorithms um as an own C library which
is called liptoper toolbox. Okay. You
see that in the center of that figure
here and top toolbox 3 the matlab
version basically interfaces to that
library uh using the max functionalities
so which allows to run uh C functions
from within uh top toolbox. The same is
basically happening in Pytop toolbox
which is the Python version um which
yeah already attains a yeah high
maturity in terms of what it can also
deal or have uh in terms of
functionalities like the metup version.
Um it also has a binding to lip topper
toolbox but also of course interfaces to
rest or io sci numpy and other libraries
and in fact developing that core uh
makes it also possible to create
bindings to QGIS or uh R. Okay. So
whatever your favorite programming
language is or your favorite GIS there
are possibilities now to use uh toolbox.
Now the challenges when we did that is
of course that you know a lot of
algorithms exist already a lot of
libraries exist um a lot of packages in
Python that do some of the stuff that we
are doing but you know we always were
walking on the knives edge between
reinventing the wheel okay no we don't
want that but on the other hand avoiding
that we rely too much on existing um
Yeah. Uh software architecture that we
cannot get really control of. And if
some of these software might break, then
it might tear down uh all the other
packages that rely on it. And that's
something that has to do with uh
software sustainability to make sure
that you're only dependent on other
software packages to some um reasonable
degree. The other challenge is community
involvement. Okay, many of you are
users, many of you code. Um, but I don't
know how many of you have actually
thought about contributing to their code
uh to top toolbox. So far, Toolbox was
developed and maintained by a rather
small team. Okay, but as you can see, if
you have, you know, the same tools in
different languages and so forth, it is
a hard work also uh to to do that. And
uh so we hope for more community
involvement um because it is required
FTT shell exist in other programming
languages. But of course there's also
involvement possible when it comes to
documentation to testing stuff like a
book project. Um and we offered a couple
of opportunities in the last month and
two years. A hackathon. We offered
courses at conferences.
uh an online workshop webinar as we have
it today or uh something like top
toolbox gallery which I'd like to
particularly mention. The other uh thing
that we wanted to do is also to provide
a space where people can actually link
their software or simulations tools to
okay and that is something that has
happened over the last years. So we have
created even though we haven't made
available yet TTLM 3D so a landscape
evolution model um built on top of
toolbox uh ingesting 3D lithologies.
There is also TT mini which is a um
landslide a dynamic landslide model
written by Stefan Haggarden and which we
provided an interface now to there's
graphlet uh Boris will talk about that
more tomorrow uh which is a hydrodnamic
model and there's a tool called bankful
mapper created by Michaela deiavo uh
from the university of Roma wand um who
or which provides tools for deter
determining the bankful discharge in uh
or based on uh higher resolution DMs. So
I can only encourage you check out our
GitHub organization to learn more about
these tools and to get an overview. But
I know that it can be a bit you know
intimidating sometimes to see all the
stuff there. Uh so uh we provide
guidance here. So the other thing that I
mentioned is the top toolbox gallery and
that is something where I hope that
people will contribute to in the future.
Again we will talk about that later on.
Um it gives you an opportunity to
showcase your own code um online
together with a lot of other examples
and people can learn from that and you
can showcase your study. Okay. So this
is just a very brief introduction at the
beginning. Um now before we head on we
would like to know a little bit more
about you and how you use Topper Toolbox
and to do that we have prepared a small
survey and so if you have your
smartphone with you just next to you uh
please scan um this um QR code and you
will be brought to um a Google survey.
Um, alternatively, D perhaps you can
also if you have the link with you
because it's not the link is not on here
but perhaps you can post the link in the
chat. Uh, so for people who don't have
um a smartphone just at the fingertips.
Okay. So we can can go ahead. Um, I
think it doesn't take much more than a
minute or a minute, minute and 30
seconds and we're waiting for your
answers to come in and I'll just
continue talking during real waiting.
Okay, I think all of you might have
scanned the QR code. If not, let me
know. Okay, so I'm going to go to the
next slide. Um and hoping that you have
all scanned the QR code and were able to
fill in the survey. Okay.
>> The link is also in the chat so you can
continue I think.
>> Okay.
>> Right.
>> Okay. So um what up next? Uh the next
thing is uh introducing you to toper
toolbox in MATLAB. Okay. And um while we
are doing that uh just a couple of
notes. Uh perhaps I should have said
that earlier but please make sure that
while we're doing the presentations um
um that the microphone is muted. I think
we have agreed on rather that uh the
microphones shall be muted like all the
time because um this is a webinar and
which will be recorded and will be made
available on YouTube. Um so um if you
have questions please write them in the
chat. Uh you can do that anytime. Um and
there will be a dedicated Q&A session um
in the midst of this session today where
we will address your questions then we
will moderate those um a little bit so
that it remaining exciting and not too
much overlap within the questions. Um
okay okay so um the exercise or the
let's say modeling uh programming uh
demonstration let's say takes us to the
Rome plateau on the Colorado plateau in
in the US um and what we are going to
show is how we can quantify rates of
landscape rejuvenation by flu wheel
incision and nickpoint migration in
response to base level drop. Okay. So,
we are going here to that area that is
marked here with that um white
rectangle. And what you can see is
basically a landscape that is heavily
insized by canyons. And these canyons,
you know, they um yeah, inhabit not the
entire basin as you can see, but you can
see that the basin consists also to a
big part uh of some old remnant paleo
surface. And where those rivers starting
on the paleio surface basically go into
the canyons that's where nick points are
located. So nick points are convexities
along the river profile. And we will
take those convexities or nick points to
study the dynamics of this incisional
process that has basically rejuvenated
that landscape. Okay. The demonstration
will guide you through you know the use
of topper toolbox and what we plan to do
is in particular in that first phase to
focus on three numerical objects that
are part of top toolbox that's the grid
object the flow object and the stream
object at a later stage we will also
talk about PPS which is about point
patterns on stream networks okay now let
me switch my um window. Okay, let me
just so Okay, so you should all see um
Matllet um and yeah, before we start
actually let me say a few words on how
to actually well download um Tupper
toolbox and how to install it. Okay, um
it has never been as easy as it is now.
Okay, so where you should go is GitHuber
toolbox. So the topo toolbox
organization which is there to you know
to organize all the different
repositories uh within um the topo
toolbox realm let's say um to install
top toolbox the matlip version go on top
ofbox 3 which then brings you to the
repository and once you're here go on
release we see that the most recent
release is pretty young just reflecting
that we did a couple of changes right
before the webinar and then you can go
down and then choose uh your operating
system whether you have Linux, a Mac or
Windows and there's also a version that
is means um no lip tt which just means
that there's no lip topper toolbox with
it. This is something that you might
want to use if you are using topper
toolbox in MATLAB online because the
other ones won't work with MATLAB
online. Okay, once you're here, download
your the toolbox of your choice and then
you know you can directly open it. I
won't do that. Um but it will be opened
in MATLAB and then it's installed and
there's nothing else you need to do.
Okay, once you have done that you can
check whether you know whether you have
uh or whether everything is uh correctly
installed um by just typing grid
objects. Okay. And you can see okay
since you have some order completion
here it seems to be available. Good. If
that is the case great uh you can also
check has lip topper toolbox and if it
says true which it should then that also
tells you well even the binaries have
been successfully installed um or they
are available um and so we can get
started. Good. Okay. So what I'm going
to do now is to to walk you through the
code um and give my explanations from
time to time. I will also just live code
uh not all of it is live coded simply
because it would take too much time to
do that uh for all of the functions in
particular when it comes to plotting.
Okay. So first of all your analysis
probably starts with a DM uh that you
need to download from somewhere. Okay.
um that somewhere is best expressed in
terms of coordinates. Um so for example
like these four coordinates from east uh
west to east and from south to north um
which can be then put into the function
which is called read openo. So what read
openo does is it uses the API of open
topography to enable downloading all
kinds of different DMs. Here we chose
the DM type COP 30, but you can also use
other ones. And if you remove that, you
know, you get a list of all the
different DMs that you can take. COP 30
is a fairly good DM um which we will use
here. Okay. Now, we'll run that code.
And what you see here then is a message
that either tells you that now your data
is downloading or like in my case uh
well that the downloaded DM is not in
protected coordinate system and so
forth. What has happened here is that I
have downloaded that data before also to
make sure that it's there and it's in
the cage in a top toolbox cage. Uh so if
you run that code again it will just
take um the DM from your hard drive
rather than downloading it again. Your
message will be a little bit different
and also what you need if you run that
is an API key for open topography u
otherwise um you will get an error but
there will be a message that tells you
enter the API key here um to go forward.
Now what we have is DM that's a grid
object. Okay. Now this DM comes in
geographic coordinates. Okay. That's how
open topography distributes its data. Um
but for most of the analysis that we
want to do uh we will rather need um a
DM in a projected coordinate system. So
we are going to do that using for
example the function repro to UTM. Okay.
So that's a fairly easy function which
just requires the downloaded DEM and the
only thing you need to yeah provide is
um that the output resolution 30 meter
in that case um and it will then project
your data into a uh universal transverse
macado projection. Okay, so this works.
And if you plot your DM, I'm going to do
that here using the function image SCHS,
a function which is quite nice to, you
know, to plot a hillshade. It just means
image and hill shading, a scaled image
and hill shading. Um, you can see we
have our DM here. Um, the only thing
that bothers a little bit is these wide
edges here. um which come uh by the
transformation into another coordinate
system. We can um remove those using a
command uh which is called largest
inscribed grid. Okay. So what the
function does it tries to find the
largest grid within your uh DM that
doesn't have any missing values. Those
are the these white areas. So let's do
this again and then we can plot our data
image ss and the result will be this one
here. Okay. So we have removed the edges
and we have um a DM which is in a right
coordinate system to go on. The next
step is then having that DM to derive
the stream network and to do that uh we
need two steps. The first one is to
derive a flow object. That flow object
is derived from the DM itself. Um and
contains all the information required uh
to infer flow directions. Okay. By
default, the flow direction algorithm
used here is a single flow direction or
D8 flow direction meaning that we have
always converging flows no diverging
flows. Okay. So FD you can see it in
your workspace that you now have FD as
an additional variable which is called a
flow object. It's basically the flow
direction grid that you would have in
any GIS but it has a better way to store
the flow directions and so it's much
better and faster that to use this one.
Based on the flow object you can derive
a stream object. So what is a stream
object? Basically it's just a sub
network of the flow object. So meaning
that well we just want to have the flow
network for those parts of the landscape
where you might have constantly flowing
water for example and that just happens
or permanently uh flowing water and that
happens let's say where the um upstream
area exceeds a certain threshold. In
that case we can just say if it exceeds
for example a thousand pixels that flow
together that's where basically streams
begin. Okay. So we are going to plot
this stream network. I'm going to going
to do that in the command window. Okay.
So we have a nice representation of uh
the river network in our area. Now let
me go back. What we want to do and what
we want to focus on is that catchment
here in the middle. Okay, I hope you can
see my mouse uh that shows it. And
basically, you know, from from that
point on, we're not that much interested
in that part here. That's the Colorado
River that is also not completely here
covered by that. Um the we're just
interested in in this basin. Okay. to do
that there are different approaches but
I'm going to show a little or one here
which is actually quite uh cool because
it's completely programmatically
uh I will also provide code that shows
how to do that more interactively but we
can just the first thing that we are
going to do is to extract the large com
connected component which means we are
extracting the largest drainage basin
and then in the second step well let's
do that and I give you an intermediate
result so that you can see what has
happened. Okay, now all the small basins
have been removed and we still have that
one and then we just want to have that
one here. Okay, upstream of that
junction. Trick that we are using here
is to identify that part of the network
that is somehow connected to the edges.
So where some of the streams are just
you know have upstream areas that are
directly connected to the edges. And so
this is what we are going to do here. um
remove edge effects like this. Uhhuh.
Okay. Now, we already have this stream
network here, but a bunch of other ones
which are probably not connected to the
edges. The only thing we just need to do
now is to run K largest concoms again.
Okay. And here we go. So, that's our
network that we want to look at. Um as I
said before, there are other ways to
approach this problem. Um but um for the
reason of times, we I won't do it here.
This is also not a method that works
with every DM for sure, but it should
show you that by combining different
tools, for example, also the function
modify that you have a lot of
possibilities to programmatically
uh modify your stream network. Now we
can we create a map. Okay. And to see
whether we have done everything right,
um me just um
I have always this this bar in front of
me. Okay. So, so we identify in the next
step the drainage basins based on our
stream network that we identified and
then there's some additional plotting
stuff uh that together then gives you a
relatively quick map. The next thing
that we are interested in is to plot the
river profile. This can be done using
the command plot D set. So we take our
stream network and we take elevations
which are not stored in the stream
network itself. Uh but we take those
from the DM and see our flow or our uh
representation of the uh distance versus
elevation. Okay, great. And what we can
see is okay we have a main trunk river
that you know once it goes into its
tributaries these tributaries go pretty
steeply up but then they transition into
more flatter sections or less inclined
sections uh which basically represent
these uh paleo surfaces or these rel
surfaces. And you can see that those
relict surfaces are basically separated
from uh those canyons uh by nickpoints.
Can see those here. We could identify
them by hand. But what I'm going to show
next is how to use the so-called
nickpoint finder. Okay, I'm going to use
it like this. Nickpoint binder
takes the s the DM and the stream object
and then uh what we need to define is a
tolerance. This tolerance can be set
fairly high here 200 m because those
channels are actually so steep in size
by 500 to 700 m that this is a we can
really have a fairly large tolerance. In
other instances, you should choose a
smaller one because otherwise you don't
get any nick points. And we just say
split is false because otherwise um it
only makes sense to make split uh is
true if you use your um if you have the
parallel computing toolbox and if you
have multiple basins. Okay, so you get
an idea how that algorithm works. Now it
is already finished um and it has
identified 36 nick points. Let me close
this again and we can plot the results.
That's what it is. Okay, so we have our
river profile with the identified
nickpoints and these nickpoints are here
also shown in map view um showing yeah
where we have our nickpoints and I think
we quite reliably detected those. Okay,
the next step that we want to do and I
yeah need to come to an end uh just in a
second at least for that first part is
Kai analysis. When we analyze uh
nickpick points and I'm going to talk
about that in more detail later on. Kai
analysis is extremely helpful in
identifying the mechanism behind
nickpoint formation. Um here I'm just
showing how to compute it and I will
give a few more sentences or provide a
few more sentences later on about what
is actually done by that function. So
kai transform um s and a what is a? Well
we need to compute it before we have it
here. A is upstream area a equals
upstream area which is calculated by the
function flow act which is flow
accumulation and then we do our kite
transformation um providing some
additional input here n ratio of 0.45 45
as I said before I'm going to say a few
more words about this later on and a Z
which is a reference area which is often
set to 1 million so 1 million cubic uh
square meters okay the only thing that
we now need to do is to plot it to
receive something which is called the
kai map okay and what I'm going to do to
make it look nicer is to have a
underlying uh hillshade
color map. Yeah, I just say it should
just be white. Okay, so it just has just
shades of gray. Um, and in that case, we
don't need a color bar. Hold on to make
sure that you're plotting on the same
axis that we had before. Let me just get
a figure before. And then plot C. And
plot C is a function which plots the map
layout of a stream network, but gives
some additional coloring. And in that
case we are going to color the network
uh using the kai values. Finally we add
a color bar and say okay
it's label string should be kai and kai
has the unit meter. Okay let's run this
part. And here we go. Here we have our
first kmat. The only thing that is
missing is the nick points itself. So we
add those as well. plot kpx and kp y. So
this is what is contained in this
nickpoint uh data structure returned by
nickpoint finder um okay which just
means we have circles and uh which are
plotted in black. Now let's run it again
and here we go. So this is from my side
so far and I will hand over to will show
exactly the same thing and how it works
in Python. Okay, I'm stopping here and
hand over to you, Will.
>> All right. Um, so yes, hello everyone.
I'm Will. Uh, and I will be going
through basically the exact same example
that Wolffgun just showed. Um, but using
PI Topa Toolbox, which is our Py new
Python implementation of the Top Tool
toolbox interface. Um, we you've heard
us mention the Tupper toolbox gallery a
few times. So, um, I hope you can see
that my screen here. This is our our
gallery web page. uh topple
toolbox.github.iogallery.
I believe I posted the link in the chat
earlier. Um and you can find a bunch of
examples that we've created for doing um
using tpple toolbox in both mat lab and
python here including the um mat lab
live script that wolf gang just
presented this fluial nitpick points on
brain plateau mat lab version and
there's also this python jupitter
notebook which is what I will go through
um now but uh first I will show uh the
process by which you can acquire pyle
toolbox um it's a little bit more
complicated than than mat lab partly
because there are a few um different
ways you can install packages in python.
Um I'll show you a simple way that uh we
know works. Um if you are a python user
and you have other ways of installing
packages and feel free to try those out
if your usual way of installing pytopics
doesn't work uh please let me know um
open an issue on the GitHub repository.
We'll talk more about how all of that
works later. Um, and we'll uh try and
fix it so that it does work. We've had
issues for instance with um installing
packages with Anaconda particularly on
Windows machines in the past. Um, so if
you're an Anaconda user and you have a
Windows machine, uh, please try it out
and let me know how that works. Um, so
now you should see a terminal window. um
uh here uh so I have already prepared a
um virtual environment um a Python
virtual environment for this webinar. So
I'm going to go ahead and activate that
one. Um this has some of the the uh
other dependencies that we need um
already installed on it. So we don't
take too much time doing that. And I'm
just going to install the latest version
of top toolbox using pip um pip install
top ofbox. And this will work um where
you it'll go through uh install uh bunch
of packages that are required by top of
Toolbox um to function and you see
toolbox version 0.0.12 is the most
recently released um one and you'll need
that to run the um ren plateau uh
Jupyter notebook because it's got some
uh new functionality that we recently
added there. So now having that um
installed uh I can open my Jupyter
notebook um interface. Uh as I said I've
already installed Jupyter notebook in
this environment. Um you would have to
install that separately or have a um you
know copy of it somewhere. Um so uh you
can see I've uh put this down. Hopefully
you can still see my um Jupyter notebook
window here. um let me know in the chat
if anything goes wrong there. Um this is
my directory with all of the uh Toolbox
code in it. So I'm going to go into our
gallery repository. Um so uh
excuse me double click in this
uh runto. You can see the path here. Um
and this is where you can find the the
notebooks within the gallery repository
if you're looking for them. Um, and this
Rome Plateau one is the one that we have
published on the gallery web page. Um,
I've created this other one that has
some of the code taken out so that I
can, um, type it in for you here. Um,
so, uh, if you're not familiar, this is
the Jupyter notebook interface. Um,
uh, as with the Mat Lab live scripts, it
it's kind of a computational notebook.
It allows you to, um, run code text as
well. Um so the first thing we need to
do when we start using PI top toolbox is
to um import some packages uh including
top toolbox itself. Um so in Python we
do import tutorial box. Um I usually
call it TT3 because top toolbox is a bit
much to type um over and over again. Uh
and then I'm also going to import excuse
me uh map plot lib pipot
uh map plot lib is included with the top
of toolbox. It's a dependency of top
toolbox. It'll get installed when you um
install the python toolbox. Um and we
use this for plotting um the kind of
default plotting uh system within top
toolbox basically net plot web. Um we're
going to import uh some more stuff from
net plot web. So we can do some uh hill
shading as we saw before. Plotting in
Python as we'll see is a little bit more
complicated than it is in mat lab. We'll
use numpy which again is a dependency
top toolbox um for array computing and
raster io is what we use um by default
to load dems. Um so it's also included
as a dependency and we're going to
import the coordinate reference systems
from there because we'll use that to do
the reprojection later. Um so these are
kind of the packages that I import when
I start running top of toolbox. Um you
can do everything um more or less with
just the top of toolbox import. Um and
you can use the top toolbox functions
for plotting and everything but to make
nicer looking plots or to do some uh
more sophisticated analysis you might
need some other um of our dependent
packages available to you in the um your
environment. So, as before, we're going
to load this um DEM. I'm going to uh
probably not talk so much about the
scientific parts of this analysis and
more about the differences that you'll
encounter when using Python top toolbox
in Python from using mat lab. Um and
some quirks of our implementation, but
uh because every all the analysis that
we're going to present is basically the
same as what we did before. Um so, we're
going to load this from the open
topography API. Um the first difference
that we'll encounter between Python and
Mat Lab is that the function we use to
do that is called load open topography
not read open top of so a lot of the
functions in the Python version have
different names for various reasons. Um
uh it's something you will have to
figure out. Um you can look at the
documentation for instance that has
listings of all these functions and um
hopefully that'll figure it out. That'll
help them figure it out. also the
examples um uh of that are provided in
the gallery are good resource for
learning what all the the functions
might be called in um Python and then
we'll supply instead of the extent um
vector uh we'll supply the coordinates
as keyword arguments with um
this right
okay now we have the dem type is 30 So
otherwise it behaves pretty similar to
um the mat lab version of read open. So
we'll load that and um as before this uh
as wolf going showed the um I've already
loaded this DM from the API before so
it's cached on my computer. Um if you
don't have it cached and you have an API
key this will download it and it might
take a few seconds to download. Um we
will uh do our reprojection
um as before and for this we use a
function it's just called repro and we
give it a coordinate system um
specification. So the easiest way to do
this is from um using the CRS uh object
from raster io and then here we'll just
give it the EPSG um code for the correct
UTM zone which is in 12 north um the mat
lab reproje to UTM has some logic that
uh figures that out for you but that's
something we haven't implemented in
Python yet and specify resolution and
then we can visualize this DM with plot
HS. So this plot HS method is the um
equivalent of CHS from MATLAB.
It'll plot a cool shaded raster with the
color map um of it. You'll notice here
that uh the methods on grid objects are
called by um taking the name of the grid
object dot the method. This is Python
syntax which you may be familiar with.
Um whereas in mat lab you pass the grid
object as the first argument to all of
these things. So most topics functions
are methods on one of our objects, a
grid object, a flow object or stream
object. Um in mat lab the first argument
of all those functions is that object
and that's the one that you call um the
method on in this um is just a good way
to so we visualize it and there we go.
So this is our DM unloaded um and we see
our the missing data along the edges
that we get from the loop projection.
Now in mat lab we use largest inscribed
grid to um
uh fix that. But you'll notice if you
try largest grid that we don't have that
implemented in Python yet. So there's
lots and lots of functions in the mat
lab version of top toolbox. Not all of
them have been completely ported over to
Python yet. Um this is one of those.
it's a little complicated to um get
right. So, it hasn't been a high
priority. Um there is an issue on GitHub
and there's a link in the notebook that
you can use to um check that out. If
you're interested in contributing,
that's a great place to start. You can
look at the MATLAB version and try and
port it over to Python for us. Um but so
instead, I'll just use uh our crop
function um prop. And I've gone through
and found which pixel indices are the
correct ones here. So you would have to
do this manually. Um otherwise kind of
looking at the DEM. Um this is it's a
little annoying but it is what it is at
the moment. As I said if you're
interested in contributing at large disc
but we'll crop it. And there we are. I
cropped the um with nodes and data. All
right. So having done the uh prepared
the DEM for analysis we can now identify
our stream network. This is pretty
similar to how it's done in mat lab. We
have a um a flow object constructor that
would take a DEM. Note that instead of
being called flow obtain
is one of the naming differences. Um and
uh that will create our flow directions
object there. And then we can be our
stream object the same way the passing
flow object and the threshold of
passing.
So that will do our flow routing and um
identify the the streams that are
considered to have kind of perate flow
in this um system. Now we can plot um
the stream network on our DEM as we did
before. Uh, as I said before, plotting
in in Pytopex is a little more
complicated. It's a lot more explicit
usually than what it is in in mat lab
where you're able to just kind of call
the plot methods. Um, you kind have to
interact a little bit more with mplot
lib to use correctly. So I'll create a a
subplot. This is using the piplot
function subplots. So create a a
plotting window and then we'll plot into
that so we can get the hillshade grass
plotted. um into that axis we pass the
axe the plumbing access as the ax
implement there and then we stream on
top of that. Um there this is our stream
object uh as identified um by our
constructor. Uh now we want to select
our parachute creek catchment from the
center of this DEM and we'll do this
exactly the same way as we did in uh mat
lab using the uh k logistic
components method which is a method on
stream objects. propended with the S do
a components. We then will do remove
edge effects with the flow directions
object flow object there and then select
the um low disconnected component um
outputs remains in that. We'll run that
and now we will plot our nice little
plot of the parachute creek drainage
basin. basically identify the drainage
basins using the drainage basins method
fill object. And instead of passing the
um stream object, we have this outlets
argument which requires you to do a
little bit of um array manipulation to
figure out where the outlets are. I'll
use the stream POI function here to
select the outlets of the single basin
in our streamlin. And then this we index
into the stream array to convert that um
the index that this function returns
into an index into our uh DM as a um
which is a little complicated but uh you
you'll get used to it as you start
playing this.
But we created drainage basins. And now
we will plot our um the drainage basins
as a hillshade. Um so here this may be a
little confusing, but we're going to
plot the hillshade. The the data that
we're going to plot is the drainage
basin. So that's why it's the the one
that's called um on the method. And we
pass the DM as the L of argument to
actually do the full shading rather than
to the axis. Um and
uh this is just to set up a nice color
map for that show. Um
plot the stream object on top of that.
And in the second axis we'll plot the
screen profiles with the plot dz. Make
sure that basically the same as it is
now work. Yes. Um so there we have our
drainage basin with the stream network
identified and the stream profile. Um
you can play around this plot to adjust
the um the layout a bit more. Um this is
something that you uh at the moment kind
of have to do a little bit on your own
in Python.
There we go. Our nice stream profiles.
We can see our nick points up at the
upper reaches of our uh streams. So now
we will go to identifying nickpoints and
once again this is pretty similar to um
mat lab we use the nickpoint finder
which is a method on stream object give
it the BM and the tolerance um in this
case we're using 100 meters the same as
we used in the m um and yes uh the the
output of the npoint finder is a little
different in Python so it's it's a array
that tells you where the nickpoints are
rather than an array that contains a
bunch of information about nip points
like their coordinates and things. Um so
you have to obtain the um information
that you're interested in plotting
separately. So here we're going to
identify the nickpoints that just tells
us the locations um within the stream
network. And then here um we'll create
an array of the elevations of those
nickpoints. So we use the easy get nal
function to extract the elevations from
the DEM and then um index by the the
nick points to pull out the elevations
just at those uh nickpoint locations and
little plot. I am going to to save time
copy and paste this plot from the direct
notebook here is very similar to what we
just did before. Um we have the
hillshade of the DEM
uh the plot of the stream network and
here we plot the um x and the the nick
points but using the x and y coordinate
vectors of the stream object. Sx is the
x values and sy is the y values of those
um every node in the stream network. And
so we index by the nick points to um
pick out which ones of those are nick
points. And then we'll do a string
profile again very similarly plotting
the um elevations that we extracted in
the previous step against the um
distance of the upstream distance of the
stream network again uh index by the
midpoint values there and there we go
we've identified all our nickpoints
there both on the map link in the stream
profile and then finally uh we will do
our kai analysis here um again the
analysis is very similar to the the mat
lab web version. Um we use the flow
accumulation function rather than flow.
This is another rename and the kai
transform giving the flow accumulation
the reference area and the mn ratio um
assumed to be zero that will compute the
kai transform and then uh plotting. So
at the moment we don't have a um stream
object.plot plot C function which allows
you to plot the um
uh stream network uh with a color. Um so
here I just do a a scatter plot of the
um x and y coordinates of the stream
object colored by that kai transform
value. uh if you're at a large enough
scale and you can't really see the dots
and they they overlap and it it looks
all right. Um here there are more
complicated ways if you want to do
something more similar to what plots
does um in mat lab but there we go our
kai map
of the parachute creek catchment done in
pi top toolbox. So I think that
concludes my presentation of this
segment. Um, so I thought sharing my
screen.
>> Thanks, Will. Wolf gang, do you want me
to just continue right away?
>> That's f.
>> Okay, great. Uh so we are more a little
more than an hour into our twohour
session and uh we've seen examples now
and as was written or as I have written
in the chat we also um have now
something like 25 minutes maybe for
question and answers and instead of uh
you asking the questions personally we
opted for uh typing them into the uh
chat window and there are few questions
in the chat window so far. I noted them
down but then we have a bunch of
questions that were typed into the
questionnaire that we sent around
initially and now I have them on my
screen and somewhat sorted. So we want
to address these questions one after the
other and see how far we get and um
right so I will just start away and ask
uh Wolf Gang and Will um one user said
that um they use Tupo Toolbox 2 and they
just started with Tupo Toolbox 3 and is
there something to be aware of regarding
old files that were built with Tupo
Toolbox 2?
>> H well I think I can comment on that. Um
if you have files that contain let's say
uh grid objects and so m files uh
containing grid objects or flow objects
um these might not be read by uh if you
you know if you have top toolbox 3 on
your uh path in in matlib because the
structure has slightly changed. It's a
minor change in fact uh of how we handle
transformations. Um it's also a change
that you know was necessary to comply
with um changes in the mapping toolbox
and new functions here. Um so you might
face some issues here. Um so best thing
is probably to export your DEM from top
of toolbox 2 uh to a grid object uh to
sorry to a TIFF and then read the TIFF
again. Um that should be all right. The
other thing is that you know if you if
your implementation relies on liptoper
toolbox the top toolbox or top toolbox 3
relies on lip topper toolbox. So there
might be minor differences in the flow
network that it might be somewhat a
little bit different than uh the ones
obtained in TT2. Um, this is what you
might consider, but otherwise I think
everything should work as it did in top
of Toolbox 2. If it doesn't, let me
know.
>> Yeah. Yeah. I guess there's not much to
add maybe from Will's side or is there?
>> Um, no. Yeah. I mean, the the the
details about the the liptop toolbox
flow network differences are
interesting, but uh I think rather
technical and not of you, you can find
me and talk to me if you're curious.
>> Great. Thanks. Uh also um when there are
specific questions uh we have the GitHub
uh organization for the tupal toolbox
and there also uh there are
possibilities to ask questions there and
to get help right will do you want to
say something about this?
>> Yes. Yeah. Um so uh there are many ways
to uh contact us uh through GitHub which
is where most of our um organization for
the project is is happening at the
moment. So um you can if you have pro
specific problems with the software the
best way to um you file a bug report
essentially is to open an issue on a
repository I'll put a link in the chat
um to the issues on pi topper toolbox
bugs for instance um so uh you know if
you have a problem you want to report
there if you're thinking more about if
you have more of a a general question um
about you know top toolbox especially a
more scientific questions, you know,
what can I do with top of toolbox? We
have a discussion forum um which I will
also post a link to that's also run
through GitHub that is an excellent
place to um ask those kind of questions.
>> Okay, perfect. Well, then there was
another question asked early on and uh
the question was about liptop toolbox
and even though it's somewhat specific
most questions are relatively specific
so I'll ask it anyway. Uh does lip top
toolbox currently support scale
dependent analysis of river platform
geometry such as multiscale senosity or
identification of characteristic meander
wavelengths. Wolf gang will so what can
you tell us?
>> The short answer is no. Um but it it
could there's no reason why it couldn't.
Um, and that you know if that's
something you're really interested in
like uh you know get in touch uh and we
can see what kinds of things we might
need to do to uh make that available to
you.
>> Good. Yes, there was also the question
or the comment of a person who wants to
integrate toolbox with cascade and uh
maybe I asked back the question via the
chat. uh that person um could you please
specify which cascade because I looked
it up and there is a cascade landscape
evolution model which was developed by
Jean Brown. I think that was developed
in Fortrron and I also noted there is a
coastal erosion model. So maybe you can
specify that question and then we at the
moment move on to the next question
which is about nickpoint detection. Wolf
Gang how to estimate the tolerance for
nickpoint detection. If it is too high,
not all nickpoints are found that were
identified in the field. But if the
tolerance is too low, too many nick
points which uh do not exist in reality.
So how to identify the best tolerance
value?
>> Yes, that's a a good question um that
I've received also before. I've actually
covered that also in the top toolbox
blog uh which is still active and which
continues to be active. Um in short um
what you need to consider is what is the
error in your DEM. Okay. And so the
nickpoint tolerance should be at least
larger than the kind of average error or
actually more like the maximum error
that you see in your DM. And then you
can do that using a couple of tools. It
will be too much uh detail here but you
as I said before you will find the
description in the top of toolbox blog
um I can also send the link later on um
uh which describes this like you're
creating a band uh around an arrow band
around your DM indicating let's say the
10th and the 19th percentile and you
know the tolerance should at least be as
big as that band or even larger and that
uh makes sure that you know you don't
just map a lot of uh errors in your uh
DM, but rather get the signal behind the
noise.
>> Okay, great. Uh yeah, or you also
mentioned the the block uh which still
exists. Um but I think and correct me if
I'm wrong, Will, some of the blog uh the
posts that you have there are now part
of the gallery, right?
>> Yes, that's true. Um, and uh, you know,
I think we're kind of slowly migrating a
lot of the um, you know, more
substantive posts from the blog over to
the gallery. Um, the blog I I assume
will continue to exist um, you know,
going into the future. We may we may
move some stuff around or or find
another hosting solution for that at
some point.
>> Okay, good. Thanks. So, I have another
question um, which is directed maybe
towards Boris and Wolf Gang. It's about
the feasibility of DMs with different
resolutions to use add-ons such as
bankful mapper and graph flood
especially if these are lighter derived.
No sorry especially if lighter data is
not available. So how useful is graph
flood if there's no lighter data
>> right I may answer that one if you can
hear me
>> yes
>> perfect so it's roughly the same answer
that uh vulgar point it depends what you
are trying technically speaking graph
flood works on any type of of resolution
and in top paper that just came out as a
discussion paper we tried it on a
copenic 30 m so it definitely work but
your river needs to be wide enough to be
described by uh by the model and then
there might be a bit of uh physical
parameter tuning like friction
coefficient and everything. We will talk
more about it tomorrow. But yeah, it can
work with any resolution as long as you
can see the object you're trying to
measure.
>> Uh W do you want to add anything on
bankful mapper or is that um
>> well I can only say that here you also
need a good representation of the river
and its banks uh and which is probably
hardly feasible if your DMS is too
coarse. Of course, you perhaps you don't
need LAR. Um perhaps a 5 m or 8 m
resolution model might be good enough,
but I can barely imagine that it works
with uh the common global DMs.
>> Okay, good. Thanks. Uh Wolff, I have
another question from you for you. One
user would like to know about creating
DMs of differences and tools for
mometric analysis. I guess in connection
to those DMs of differences are there
specific functions or functionalities
currently because I guess DMs of
difference require precise
co-registration which is not necessarily
always the case.
>> Yes, exactly. So there is no let's say
dedicated function to or set of
functions that let you work with DMs of
difference. This is might be a nice
add-on perhaps in the future. If you
have some good ideas for for what to
implement in in top toolbox in whatever
language, go ahead please. What can be
done of course is just to substract one
DM from the other one and to make sure
that the underlying geometry is
basically so of two DMs is actually the
same. Um so interpolating one or
resampling one DM to the exact geometry.
So same extent and same um pixel centers
let's say uh this is uh no big deal
using the function resample or repro if
they or project if they they come in
different uh coordinate systems
>> okay good
>> well there is another somewhat longer
question that I took on myself now it's
about many studies using kayen channel
steepness index as indicators of
landscape at this equilibrium and
erosion potential And then how well do
these topographic metrics correlate with
basin wide erosion rates derived from
tenderillum and can they be used as
reliable proxies for long-term
denodation across different tectonic and
climatic settings. I would say this is a
scientific question which is very
interesting but it's very hard to to
answer in the scope of this uh the
seminar but in fact I mean this is
something where many papers have been
published and it's probably useful to
get into the details of these
sightspecific studies but overall I
think there is good evidence that there
is some correlation but um it's it's
hard to make um you know blunt
statements whether this works everywhere
and for every setting. So, uh, Wolf
Gang, how do you choose a sensible value
for the threshold on flow accumulation
when creating a stream network, a stream
object?
>> That's a good question. It's, uh,
basically where do channels begin,
right? And I have no good answer to that
except that, you know, it's often a
trial and error, just seeing whether,
you know, it works for you. Um, and of
course, um, it depends on the DM
resolution.
um and what kind of channels you want to
capture. Um if it's if it's just the
main rivers, of course, you choose a
larger um cutoff. Um and if you want to
go up to the divide, you choose a very
low uh cutoff. But at the um you need to
be cautious to not map the hill slopes,
but there might be cases where you
actually want to do that. So it's up to
you. It's a trial and error process.
there is no good answer and it depends
on the climatic setting in which you are
and probably also uh even the uh
lithology. Yeah, maybe I can add to
that. Um that when you plot slope
against area, drainage area um from
theory we often think that in on hill
slopes we have either a constant or even
declining slope angles towards smaller
drainage areas and only when you have
this rollover and then uh approaching
the area where slope and area is a
linear plot on a lo lot lot then um you
are in a in a fluial domain. Uh however
this is not always easy to apply to
course resolution DMs. But another thing
that I think nowadays can be easily done
is when you derive a stream object and
export it for Google Earth and then plot
it in Google Earth, you often have very
high resolution uh satellite or aerial
images and you can zoom in and you can
figure out really whether the streams
that you have derived using a certain
certain threshold coincide with streams
in high resolution satellite imagery or
if it's really already on the hill
slope. So this is maybe something uh to
to do. But it's clear that in like aid
settings and weak rock types, you
sometimes have drainage areas that are
very very small and that are hard to see
even in uh satellite imagery. Okay,
good. Wolf gang, another question if we
have time. Yes. Uh how sensitive are
topo toolbox derived KSN values to DEM
resolution and stream extraction
thresholds particularly in steep
Himalayan terrain?
>> Mhm. Yeah. um they are very sensitive I
would say um but of course it's it's the
errors and but but also the natural
variability that um is um you know the
cause of this uh yeah sensitivity. So um
talking about errors um if you work in
the high Himalayan region you will have
very steep um hill slopes uh which cause
that you have a lot of errors along the
Talvig um so and your uh you know your
river profile will have a lot of wiggles
that um you might want to uh filter out.
There are some dedicated functions for
that like the constraint regular
regularized smoothing function CRS or
quant. Um these are some functions that
are probably helpful to you know to get
rid of all these bumps. Um but
nevertheless um yeah you will need some
additional smoothing to get some
meaningful signal. Um why is that the
case? Because even if you have um if you
would have a perfect representation of
the river elevations at a higher
resolution, let's say you have lighter
data, then you would see some riffle
pool or um yeah step pool sequences that
actually show you also high variability
in river gradients which are the basis
to calculate um ken. And even here you
might want to integrate over a larger
distance. So even here smoothing is
required. So both to get rid of some of
the natural variability as well as
getting rid of DM errors um you will
need smoothing. Um and again there is no
good answer to say how much of smoothing
you need. It's something that you will
need to find out by trial and error.
>> Yeah maybe I can also add uh I think the
question is always also related to how
you intend to interpret these values. um
measuring something from a DEM and then
even calculating a metric like channel
and steepness or something is in itself
possible anywhere and can be done for
different resolution etc. But then again
uh the question is how do you intend to
use it? Is it for relative comparison
among different regions within 1DM? Is
it for comparison with let's say tambber
data or making inferences about steady
state badrock river incision or
whatever. So there are many nuances to
this and I think this is uh important to
keep in mind but there are papers that
are dealing with these kind of things
and I remember that cam wobbis in 2006 I
think had a GSA special paper where they
also talked about different resolution
maybe not but smoothing etc. So there is
some some um published work out there
that can be accessed. Maybe another
question for Wolf Gang even though um
okay so assume like many of the Tobo
toolbox functions are um using also the
big hunga catchment 30 m resolution DM
as as examples but people may come and
have their own generated DMs from
lighter or photoggramometry and is there
anything to keep in mind when using
these DMs along with the topo toolbox so
what I'm thinking about it. I could
imagine that the georreerencing may not
exist or maybe um somehow stitched
together rather than uh adhering to a
certain format or something. Yeah, I
mean yes that can happen if you have a
if you don't have any coordinate system
at all in your let's say uh lighter data
even though I think that mostly they
have there might be some unexpected
errors that might occur since we haven't
we have focused more on you know putting
functions together that that forward all
the geographic information and uh with
it or projection information. Uh we have
I think we don't really have good test
data where that is done even though they
I'm not entirely sure but um the other
thing that um of course you might need
to consider is if you have I mean you
should bring your own data obviously uh
that lighter data can become quite large
um in terms of memory requirements
uh just as a rule of thumb here I mean
um you can take as big DMs as you nearly
want uh as long they as they fit into
your main memory. Um so on my 60 GBTE
ROM machine I can work with DMs up to
30,000 by 30,000 rows times columns.
Okay, so that that's about the the size
of the DMs that you can work without.
You can even go beyond that. Um but it
can get quite slow then. Um yeah
>> right uh I think this also pertains to
um this question with lighter or
structure for motion derives. I could
imagine or we once had I think somebody
who was using an analog model like a
sandbox model scanning so producing a
DEM of that but without really any ge
referencing and so there it is possible
to use just the x and y coordinates uh
to put together a grid object with the
dm uh sorry the elevations in a matrix
but and I think you can also derive flow
object stream object and all these kind
of things but at some point there might
issues with some more specialized
functions that um are exporting
something or use basically the
projection information if that is not
available. Okay. Um so there was also
more like an internal question of what
is the stage of development uh of the
Python version with respect to the
MATLAB version and I heard that there's
also an R version.
>> Yeah. Um so I can I could talk through
that. you've seen um in the the pi top
toolbox demonstration here um we have a
fair amount of stuff uh implemented in
Python that's also available in mat lab
it's not uh anywhere near everything um
and actually there's quite a lot that
hasn't been implemented um partly
because a lot of the stuff in mat lab is
either very specialized or um uh is
designed to do things that we don't
really need to do in python you know a
lot of the functions have a lot of built
and plotting um mechanisms and stuff
that I think um at least the plan for
now is just to kind of push that off to
Mattplot Lib in Python and say like you
know you're going to create your own
plot um and add all the information and
stuff like that um there. So uh uh it
you know you you could try and measure
like which functions have have been
implemented in both mat lab and python
um uh but I don't think that's a very
useful um number to to tell you um
simply because I don't think we're
aiming for a onetoone feature parity
there. Um you could do a lot of
obviously do the the find the flow
direction the flow object and stream
object and do a lot of the um stream
analysis uh as you've seen here um we
have things like Kai we have um the
smoothing of stream profiles has all
been implemented we had a um very
industrious student last summer who um
got through a lot of that stuff um the I
believe there's a KSN implementation if
there isn't there should be um I think
we did did some work on that as well
last summer. Um so so a lot of the main
uh tools are available in Python. If
there's something that is available in
mat lab and you want to try the Python
version out and um it's not yet
available there uh do open an issue
about that because that's you know um
good feedback to know what kinds of
things we should be implementing. Um
>> yes
>> there is also the R version. The R
version is much less um further along
than the Python one. Um it works. You
can load DEMs. You can construct flow
objects. I don't think you can properly
construct stream objects actually
though. Um you could do some analyses
like uh compute gradients and access
topography. Um I know we have available
there. Um so that's definitely a work in
progress. Um we would really love more
people who like use our um to do actual
research to help let us know what that
package should look like a little bit
more. Um so if if that's you uh please
get in touch. We we would love to hear
from you and um know what your needs are
there so that can help us uh design that
a little bit better.
>> Perfect. Well, thanks Will. Um before we
end this question and answer session uh
I just took a quick look at the
evaluation of the questionnaire and
maybe just could to connect to what will
just said is uh I've seen that there are
among the different questions that we're
that we have asked that was like 40% or
more than 40% would like to contribute
uh to toolbox but they are not sure how
they can then there uh uh onethird of
the people are using Python most of the
time and then 70%
of the attendees are graduate student or
postto researchers. So I think there is
basically uh the people that are
familiar with Python and that want to
contribute and that maybe have the time
to do so. So that so that is an
opportunity to get involved and I think
will will u finish this today's session
here uh with a quick overview of how
this can be done um but I suggest that
at the moment we now move on Wolf Gang
is that correct to to the second example
that you wanted to to present. Yes,
exactly. So, uh just one more note. Um
if your question was not answered, uh
please go to the discussion forum on on
GitHub, uh and and we will try what we
can do to to answer your questions.
Okay. Um Okay.
>> And we also have I think we also have
time tomorrow for more discussion uh
which will obviously pick up content
from tomorrow, but it can also pick up
content from today. So if there was uh a
question that arose arises during the
transition from today to tomorrow then
we can also pick up that question there.
Exactly. Okay. So we are going to
continue with um a little bit of of
MATLAB coding. Okay. And um now in our
previous steps uh we um yeah basically
looked at um the the parachute creek at
the or on the Rome plateau. And I said a
little bit about you know the that this
was actually produced by an incisional
wave uh cutting through this uh yeah
paleo relief because why? because the
Colorado River basically insized and
that incision commenced 8 million years
ago and so this landscape that we see
has seen a rejuvenation phase of about 8
million years. Um now this is also shown
here in that figure. It comes from a
publication that Durk and I uh were
working on a couple of years back which
was published in geology. Here we uh
took a uh yeah bit of a more uh detailed
look at the distribution of nickpoints.
And uh what we found was that not only
you know we could predict where
nickpoints should be but also that some
of them migrated much faster and much
farther than we would expect. This is
here in the east fork uh basin and that
was due to some uh yeah divide migration
or that's what we inferred from that
data. We are not going that deep today
into the data. Uh but what we are going
to do is um to aim to you know to model
the distribution of nick points uh and
even to simulate it. Okay. Uh here to
the right you can also see just a photo
so that we just don't have uh just
digital data um but that you have an
impression how these canyons in the uh
RTO basically look like. So these are
really massive. Um okay to to get an
idea of what I'm doing, I assume that
you have heard about the um stream power
incision model before because it's the
the model of our choice that um and
actually probably also the only model
that can actually be used to to do what
uh we are doing here besides some some
other stream power based models. But
it's um well what it says is that the
river elevations change over time or the
rate at which they change um is a
function of uplift on the one hand side
and on the other hand uh due to
incision. So we're just looking at
rivers here not at the hill slopes.
Okay. And incision is a function of um
yeah upstream area which whereas as a
function of x distance in that case um
to the exponent of m and then there is
also um incision is also controlled by
slope itself. So the river gradient det
over dx and also this one here has often
an exponent which is often set to one.
Um now the only thing that I want to
mention here is if you set this to zero
then you are in a steady state um river
profile that doesn't mean that you have
uplift or so but of course you have
uplift but it's perfectly balanced by
incision and if you have that uh state
um so a kind of steady state um that
means that your slope is actually a
function of upstream area to the
exponent of M / M the MN ratio or theta
um concavity index also known as that.
Um so but your your river slope is
basically a function of a and then it's
also modulated by the uplift rate. The
higher uplift rate the steeper it
becomes. Um and also K and K is some
kind of bulk parameter that um yeah is
yeah quantifies the uh incision
efficiency. Um and so the higher the
efficiency uh is the less deep will
rivers become because the river just is
really able to insize into the bedrock.
Okay, this is a common equation that you
have probably seen before. uh it leads
us to a nice transformation which is
called uh the kai transformation. So
taking this equation up here and then
integrating it in upstream direction
gives you the what is called the kai
transformation. Um so what does it do?
Well, it takes this second uh term on
the right hand side uh and we integrate
it um in upstream direction and yeah
that has the nice property that it
linearizes the river profile. Okay, in
that case we have x not the distance but
uh sorry kai not the distance on the
x-axis and yeah what we actually have is
just a linear model where set so when
you integrate the gradient in upstream
direction well you actually get just
elevation
um you get some integration constant set
zero and then you have actually a linear
model where the gradient is determined
by K or sorry the gradient is determined
by U the uplift ratio over K. Okay, as I
said the good thing is that it
linearizes our river profile. But
there's one more thing that it does um
is that you know when you when we think
of uh the upstream migration of nick
points in our river profile um you know
it could happen like it's shown here.
you have a sudden base level drop of
about 50 m and then this yeah this drop
basically migrates upstream and you have
a series of nick points that once they
enter into tributaries uh will slow
down. Um now if we do the same in kai
space all of these nick points will
cluster at one point in kai or they will
have a very narrow range in which when
in which uh in which in it will they
will cluster. Okay. So here this is just
after might have uh you have a a level
lowering and here uh all these nick
points are all these river lines
basically collapse to one line and all
these nick points are in one point. Um
so if we assume that n equals 1 same
erodability and uplift and climate and
so forth then the time required for nick
points to travel to their location is k
times uh 1 / k. So in tow is basically
time um that is required and which is
directly related uh to k. Okay. So this
is the idea that we will take um as I
said before what we know is that um
incision started about one 8 million
years ago and we will take this
information to retrieve stream power
parameters um and then which allows us
to to model nickpoint evolution. Okay,
let me go back to um my MATLAB window.
Okay, here we are. So that's where we
stopped before. Okay, that's when we
have our kai map together with all those
uh points that indicate the location of
nickpick points. So what we are going to
do now is to learn a bit about um how we
can basically approach this using uh pps
using uh pps and pps is a numeric class
in in top toolbox which is called or
which is which stands for point pattern
on stream networks. Um it brings a lot
of ideas together from spatial
statistics and geommorphometry.
Um and is basically just about you know
the combined analysis of streams and
points and these points could be
anything beaver dams or uh landslide
locations whatsoever. Um but in the
thing is they are attached to the stream
network and so they are also used to
analyze um point uh nickpoints. So we
initiate or construct such a PPS object
using our stream network. Okay. And then
um we also need to provide our uh yeah
nickpoint locations and these are in our
structure here structure area KP which
is and this field. Okay, this sounds
probably a bit complicated but this
script. So you could also add some
coordinates X and Y coordinates but EX
grid is uh just a linear index into the
DEM. Okay. So we have the locations here
of the nick points and one thing that we
could add also to our PPS class is
actually the elevations. So we can just
input our DM from which our stream
networks was uh derived and so we have
everything together in one class and u
will also implemented that in in Python
and here it's just a some kind of data
class that we need. Okay. Oops. What did
I do wrong? It's not ex what is it then?
H it's PP the planer point pattern. So
apologies. Okay. So you see we have a
new object here a PPS object and you
know just stuff that you do is like
plotting and this is just a a simple
plot of the stream network together with
the with those dots. Okay, it makes
things easier first of all to have that
all together in in in one file and we
can also use for example plot D set in
that case we can just input P because it
already has the elevations here. Um and
here we go. Okay. So, uh PPS makes
things easier. Okay. Now, there's one
particular function that uh is very nice
um because it um it uh looks uh at the
distribution of um the points along the
rub network. So it's um it is called
rowut and rowut is just a function you
know uh that or an approach to test
whether a point pattern is dependent on
some possible co-variant. Okay speaking
in in statistics terms um I'm going to
do this here like this that I'm going to
create a new figure. I'm creating a plot
of the d versus set. So a profile with
the points and then I'm calling row hut.
Um and let's do this. Okay. So what do
we see? Well, we first of all see the
river profile again with all the nick
points. Um and then we have that black
thick line surrounded by by some
bootstrap uh bootstrapping intervals
which well the values of which are
related to the second axis here. So it
gives us a row x. So it gives us the
density of points as a function of the
distance and you see it attains
relatively high values where you have a
lot of points and then there are low
values where you have a few points. So
it's a bit like a kernel density
estimator. The only thing that it does
it accounts for the number of you know
how often this value actually occurs
along the ribbon network. So you have a
lot of channels here. So that's why of
course you have also a lot of points
here. Um now obviously our data spreads
over quite a distance from 10 kilometers
to up to 35 kilometers upstream from the
confluence. Um now let's do this again
and uh with some slight adjustments
because we are now changing um the
distance on the x-axis to kai. Okay.
Instead of plotting the normal ukidian
distance, we are going to take the um
distance that we have in the in the
variable C which is kai. Okay, here we
need to say okay, we have a certain
co-variant and that is C. Let's do it
again. And what you now see is that we
we plot uh the rip profiles in kspace.
You can see that they all collapse more
or less to one line um or at least to a
relatively narrow band. Um and what it
also shows is that all our nick points
basically cluster now in a relatively
narrow range of kai something between
you know 2,000 and 3,500 mters but it's
uh in in kai units. Okay, this already
gives us a a strong indication for the
fact that all these nickpoints emanated
from one common point the outlet in that
case. Okay. So the nickpoint started
migration from here. This is what when
they cluster really narrow the narrow
range uh this is a good indication for
that um or to to infer that that
mechanism behind it. Okay. Um what else
can we learn from the distribution of C
of of the nick points? Um there's one
nice function that I want to briefly
show. Uh it's called um you know uh MN
optim KP. Okay, we sometimes have to
work on those uh function names, but
actually it's quite easy. It just says
okay, we are we want to find the M and
uh ratio of the stream power model by
optimization using our nickpoints M and
optim KP. It's a PPS function. So it
takes P um but it also takes FD um our
flow object and then there are a lot of
options and you can you're welcome to to
read through these options um but here I
will just take the let's say the best
method it's relying it's called devian
um and it allows us to set a couple of
other you know parameters in that case
it allows us to to include
uh in our optimization scheme. The
results you will see what comes out in a
second. But some more stuff and for
example that the onset of incision
started 8 million years ago. And we
might even say okay uh this value is you
know 8 million years uh crisp probably
not. Uh there's some variability
associated with that onset. uh and we
can set this one to perhaps a million
years plus minus a million years. Okay.
We will then take a look at what is
inside. Okay. Um so let's run that
section. Okay. So it returns a structure
array um with optimized values and a lot
of other stuff. Okay. So first of all
you will recognize that immediately
0.44. Okay. So that's the optimal MN
ratio that minimizes the scatter in our
nickpoint distribution. Um we have some
uh intensity value. I will show that in
a second. Uh and there's also an in we
have inferred the K value also from this
uh approach. It's fairly low 8.2
10 to the minus 7. Okay. it has some uh
associated um uncertainty with it. This
is more or less directly related to that
sigma t that we have provided here. it
would be zero more no not zero but
nearly zero uh if we don't have any
variability here um and tow for example
now tow gives you also a node attribute
list uh which um gives you for every
location in the river network the age
when that nickpoint passed by okay and
it even has some uncertainty associated
with that so it means that if you know
if you don't have a very narrow range of
uh nick points in in kpace uh at the
beginning then of course the um
uncertainties will go up here quite
tremendously. Okay, let's just plot what
we have here. I'm going to do that
quickly because we're running out of
time. Um plot the set p distance is and
this time we don't plot pi but we plot
toao. And we can add some color data to
the um to the points so that they are
better visible. Um yes, and we plot
everything on the right axis as well.
And so we plot the intensity. Well,
you'll see in a second what it does. Um
and the distance again is towel. We add
a different labeling. Um
and this is as function of uh cut. No of
tow actually. So okay. So here we go
again. This is now slightly different
but only slightly because the M& ratio
is a bit different 0.44 instead of 0.45.
Okay. But also this mathematical model
that basically describes the
distribution. So it's a lo linear model
that describes the distribution of these
points. Now with that model um we can
now run a nice simulation. I will not
write it all down here but um but it's
something that you can uh then also run
on your desktop. It's just what it does.
Okay, we want to predict where the nick
points are at the onset at zero and then
in steps of 10,000 years up to 10
million years. So we're going even in
the future um not only to 8 million
years uh and then we are going to plot
all that. This is the top toolbox
function. The rest is just pure MATLAB.
Okay, let's run this section. It should
actually plot something, but it doesn't
want to. Let's see. Ah, it's up here.
Okay, the good thing is that in when you
do that in a MLX file, so in a live
script, it will produce a a video that
you can also then export to an MP4 or
GIF image. So, what I just plotted is
and I will run it again. It's how the
nickpoints basically start and then once
they enter into the tributaries they
will slow down until they finish. And
you know there is that point about 8
million years ago where basically all
points are pretty close to the ones that
we also identified in our uh river
network. And so it's showing well how
nice basically the model is able to
hindcast uh where nick points should
have been at some time in or at some
certain time. Of course provided that
our model is correct and the screen
power is correct as it is. Okay. So
that's it. Um you can read through the
through the scripts which are fairly you
know fairly short. I hope it's still
understandable and
uh by looking at the gallery uh online.
Thank you, Will.
>> Yes. Um so since we only have a few
minutes left, I think I will uh skip
sharing my my slides. They're not very
complicated, just uh really some links
and I'll post the links in the chat that
I would like you to take a look at. Um
but uh that concludes our first day of
our webinar. Um, we hope you uh learned
something about the new version of
Tupper Toolbox. Um, we really want to
emphasize that this we want this to be a
a community project uh that both serves
the needs of the geomorphology community
and is driven by the um members of the
community. So, we really want you to
participate in whatever way you feel uh
comfortable doing so. Um, we have many
different ways. I'll talk a little bit
more tomorrow about ways to get involved
in Top of Toolbox. Um, for now though,
I'll post a link to our discussion forum
which is hosted on GitHub. Um, so uh
that's in the the chat now. Um, and
you'll find there uh a few things uh
including one um place to post some
questions if you have any questions
about the webinar that you'd like us to
address tomorrow. um and uh thread to
introduce yourself and tell us what
you're working on and what kinds of
things you're interested in. Um we'd
really like to know, you know, who's in
our webinar and um who's in our
community and what they're using to walk
for. The uh uh as I said, we we'll talk
a little bit more about other ways to
contribute to Tupperbox tomorrow. Um we
also will hear from Boris who will talk
about his uh graph flood tool and from
Bastion who will talk about his transct
tool. Um so we'll go through those first
I believe and then have a Q&A period and
we'll talk about the contribution um uh
workflows and things tomorrow. Um so
yeah, we hope to see you there. Um and
please yeah, feel free to leave
questions in the discussions um and
start you know having some conversations
there. We'd love to see it.
>> Thanks. Yeah, thanks for listening. Hope
to see you tomorrow again.