Report bugs!

Posted on Updated on

You’ll rarely find software without bugs. The same holds true for TopoToolbox. While Dirk and I were very careful to avoid bugs by using error checking and input argument parsing, amongst other, some bugs made it to the finally published version 2. One such bug happened to be an error message issued when calling functions that use inputParser. In various instances we called the function with a capital i (InputParser), which did not issue an error for our MATLAB version at the time we were developing the code. However, MATLAB apparently became more case-sensitive in later versions. All of these bugs should be removed in the latest version of TopoToolbox found in the trunk directory.

Still, there are some more functions that contain bugs. One super-buggy function is preprocessapp which I want to update since long.

Now that MATLAB 2014b has been released, we are awaiting some new bugs to appear. The Mathworks has introduced some fundamental changes to MATLAB’s graphics system which may be incompatible with our code. Correcting for these compatibility issues is tedious since we want to keep our code clean while retaining it compatible with older versions. We are very much aware that not everyone has MATLAB (yes, it’s expensive) nor its latest version.

How can you help us? Report bugs here (use the comments)! Let us know about problems that you face with our code. We know how frustrating it is to work with buggy code.

Advertisements

New paper out in Natural Hazards and Earth System Sciences Discussions

Posted on Updated on

Roads are the arteries of societies. Landslides, flooding, and earthquakes may frequently damage roads, disrupt traffic flow and curtail the functioning of the road network. Where landslides damage roads, these may become impassable and drivers must detour these locations. The duration of blockage and the length of a detour route (extra time and fuel) determine largely the costs to get from one location to another. In the study by Meyer et al., we used existing data on road blocking debris flows, trigger probabilities and vehicle counts to investigate the impact of debris flows on traffic flow in Southern Norway. We used graph theory to emulate a traffic navigation system that finds the shortest detour route if a road section is blocked. This allowed us to determine road sections that are both susceptible to debris flows and that are central to the functioning of Norway’s road network. With only few roads connecting Norway’s capital Oslo and cities such as Bergen and Trondheim on the western coast, the sparse road network through the central highlands (e.g., Hardanger Vidda, Jotunheimen, Sogne Fjell) is particularly worth to look at. We find that detour routes connecting two adjacent junctions may be very long so that individual and local traffic costs can be high if eminent road sections are disrupted. Regional traffic may remain often largely unaffected by individual road blockages, as long as a good and timely information system exists that warns and reroutes travellers. Spatial clustering of debris flow events during extreme rainfalls with large spatial extent, however, may significantly increase detour routes even for regional traffic.

Meyer, N.K., Schwanghart, W., Korup, O., Nadim, F. (2014): Roads at risk – traffic detours from debris flows in southern Norway. Nat. Hazards Earth Syst. Sci. Discuss., 2, 6623-6651. [DOI: 10.5194/nhessd-2-6623-2014]

EGU2015 Call-for-Papers

Posted on Updated on

This is a very early reminder that paper submission is now open for next year’s (2015) EGU in Vienna. I am involved in two sessions and you’ll find information about these below. Perhaps one of these would be a perfect place to present your research!

GM1.2: Emerging research fields in geomorphology with Jan Blöthe and Sabine Kraushaar

GM2.1: Frontiers in Geomorphometry and Earth Surface Dynamics: Possibilities, Limitations and Perspectives with Giulia Sofia, John K. Hillier, Susan Conway, Tobias Heckmann, Alexander Beer and Jim Chandler

In addition and as an extension to GM2.1, Paolo Tarolli, Tobias Heckmann and I are organizing a workshop on geomorphometry for young geomorphologists. You’ll hear from us soon with more details!


GM11.3: Quantitative interrogation of high-resolution DTMs

Landslides hit rivers

Posted on

River networks in steep terrain are frequently affected by landslides. Large landslides may deliver large amounts of debris to the river, dam the river and form lakes in the backwater. Landslide dams may become unstable, burst and generate devastating floods downstream. Some dams are remarkably stable and exist for several thousand years, inhibit upstream migration of knickpoints and protect upstream areas from fluvial incision and landscape denudation. Thus, landslide dams are an important geomorphological form in alpine environments.

The Bhote Kosi landslide is a very recent example of a valley blocking landslide. Please find insights and astonishing pictures in Dave Petley’s landslide blog and at ICIMOD.

In this blog post, I like to respond to a question that I was asked a couple of weeks ago. How is it possible to draw the locations of potential intersections of landslide runout zones with the river network in a plot of a river-length profile. I’ll use an hypothetical spatial distribution of landslides together with the Big Tujunga DEM to show how such a plot can be made using TopoToolbox.

First, let’s load the DEM, calculate flow direction (FLOWobj) and a STREAMobj. For simplicity, streams are simply derived by thresholding the flow accumulation grid. In addition, we derive a stream grid, e.g, a GRIDobj that contains a logical matrix. Nonzero entries in this matrix refer to stream pixels.

DEM = GRIDobj('srtm_bigtujunga30m_utm11.tif');
FD  = FLOWobj(DEM,'preprocess','carve');
S   = STREAMobj(FD,flowacc(FD)>1000);
SG  = STREAMobj2GRIDobj(S);

Note that SG derived by STREAMobj2GRIDobj may not be equal to a grid calculated by the command SG = flowacc(FD)>1000. This is because streams must contain at least two pixels. Simply thresholding flow accumulation may sometimes result in single stream pixels along the DEM edges.

The landslide grid is hypothetical. We simply locate landslide source areas using 100 randomly distributed points. The function randperm is a perfect function to do this.

LS = GRIDobj(DEM);
LS.Z = logical(LS.Z);
LS.Z(randperm(numel(LS.Z),100)) = true;

Again, we calculate an influence map that, based on flow direction, routes the initiation locations downstream. Again, we transform this influence map to a STREAMobj, thus obtaining the potential sediment pathways starting at the landslide initiation zones.

LSi = influencemap(FD,LS);
Sls = STREAMobj(FD,LSi);

Now we need the locations were potential sediment pathways hit the river network. There is no function yet to accomplish this right away. Thus, we need to access the STREAMobj object properties. This provides an opportunity to shortly introduce these.

A STREAMobj contains various properties that contain the network topology and geometry of the river network. You can access the properties and their descriptions using the command

doc STREAMobj

This will open the help browser and will show, among other, the class properties and their descriptions.

IXgrid — [node attribute] linear index of stream nodes into instance of GRIDobj
cellsize — cellsize
distance — [node attribute] distance from outlet (dynamic property)

georef — additional information on spatial referencing
ix — [edge attribute] topologically sorted nodes (givers)
ixc — [edge attribute] topologically sorted nodes (receivers)
orderednanlist — nan-separated index into node attributes
refmat — 3-by-2 affine transformation matrix (see makerefmat)
size — size of instance of GRIDobj from which STREAMobj was derived
x — [node attribute] x-coordinate vector
y — [node attribute] y-coordinate vector

Similarly to FLOWobjs, STREAMobjs contain a downstream, topologically sorted edge list (ix and ixc). ix contains the givers and ixc the receivers. The IXgrid property is a node attribute list and provides access to the linear index into the DEM, from which the STREAMobj was derived.

We now want to identify the edges of the potential sediment network whose receiver nodes are located on the stream network and whose giver nodes are sited on hillslopes. This is accomplished by the two following lines.

IX  = SG.Z(Sls.IXgrid(Sls.ixc)) & ~SG.Z(Sls.IXgrid(Sls.ix));
IX  = Sls.IXgrid(Sls.ixc(IX));

In order to calculate coordinate pairs from the linear indices IX, use the function ind2coord.

[x,y] = ind2coord(DEM,IX);
imageschs(DEM);
hold on
plot(Sls,'Color',[.8 .8 .8])
plot(S,'k')
plot(x,y,'+k')
hold off
legend('potential sediment pathways',...
    'stream network',...
    'potental landslide dam locations')

ex6_landslidedams_01

Finally, we can use the linear indices as parameter value in the function plotdz. This will finally plot the longitudinal stream profiles together with the potential dam locations.

plotdz(S,DEM,'annotation',IX)

ex6_landslidedams_02

While writing this post, I realized that this calculation is not as straightforward as I had thought before. I think it would be much better to put all this in an own function so that linear indices of potential dam locations are directly obtained by

IX = funname(S,Sls);

What could be a good function name to replace funname?

Export STREAMobj to table

Posted on

In a last post I described how to export a STREAMobj to a shapefile. In this post, I’ll show how to write a STREAMobj to a delimited ascii text file or excel file.

Again, let’s get the data first and derive a STREAMobj.

DEM = GRIDobj('srtm_bigtujunga30m_utm11.tif');
FD = FLOWobj(DEM,'preprocess','carve');
A = flowacc(FD);
S  = STREAMobj(FD,A>500);
S = klargestconncomps(S);

imageschs(DEM)
hold on
plot(S,'w')
hold off
stream network and digital elevation model
stream network and digital elevation model

Now we need the function STREAMobj2XY. Admittedly, some of the functionality of this function does not open up by the function name itself and I am thinking of renaming the function or writing a new function. So what does this function?

[x,y] = STREAMobj2XY(S);

With one input argument, it returns two vectors with x- and y-coordinates that you can use to plot the planform pattern of the stream network.

plot(x,y)
stream network
stream network

The fact that several lines are drawn with only two vectors is accomplished by separating the vectors with nans.

Now, what happens if you want an additional vector that contains the z-coordinate and possibly the distance from the outlet. That’s easy, simply add the data to the function STREAMobj2XY.

[x,y,z,d] = STREAMobj2XY(S,DEM,S.distance);

So x and y are again exported. The z vector is taken from the DEM and the variable d is calculated from an node attribute list (nal) which we retrieve as object property .distance. Hence, you can supply STREAMobj2XY with GRIDobj (which must have the same geometric properties as the DEM from which the FLOWobj and STREAMobj have been derived) and node attribute lists. Node attribute lists are obtained from some STREAMobj methods such as STREAMobj/gradient or STREAMobj/streamorder.
Finally, if you like to export this data to a textfile or excel file, simply concatenate the data to a matrix and write it to the disc using xlswrite or dlmwrite. As an example, here I write the data to a text file with tab-separated columns.

data = [x y z d];
dlmwrite('test.txt',data,'\t');

New paper out in The Cryosphere Discussions

Posted on Updated on

Meltwater transfered from the surface of glaciers to the bed determines to a large extent ice velocities. Understanding the interaction between supraglacial and subglacial hydrological systems is thus crucial for an understanding of the dynamics of glaciers and their respond to climate change. In a recent paper first-authored by Caroline Clason, we present the results of spatially-distributed modelling for prediction of moulins and lake drainages on the Leverett Glacier in south-west Greenland. Please read and discuss. It’s open for discussion.

BTW, find some excellent pictures of Greenland’s supra-glacial lakes and moulins here.

Clason, C.C., Mair, D., Nienow, P., Bartholomew, I., Sole, A., Palmer, S., Schwanghart, W. (2014): Modelling the transfer of supraglacial meltwater to the bed of Leverett Glacier, southwest Greenland. The Cryosphere Discussions, 8, 4243-4280. [DOI: 10.5194/tcd-8-4243-2014]

New paper out in Icelandic Agricultural Sciences

Posted on Updated on

My interest in statistics, data analysis and numerical modelling has frequently spurred collaborations outside the field of geomorphology. In a recent endeavor of colleagues from University of Basel, the Agricultural University of Iceland and the Soil Conservation Service of Iceland, we used field work and data analysis to investigate below-ground biomass distribution of mountain birch in southern Iceland. Please find the paper published in Icelandic Agricultural Sciences here. It’s open access!

Hunziker, M., Sigurdsson, B.D., Halldorsson, G., Schwanghart, W., Kuhn, N. (2014): Biomass allometries and coarse root biomass distribution of mountain birch in southern Iceland. Icelandic Agricultural Sciences, 27, 111-125.