Short Communication : TopoToolbox 2 – an e ffi cient and user-friendly tool for Earth surface sciences

Introduction Conclusions References


Introduction
An increasing number of research studies use digital elevation models (DEMs) for automated spatial analysis and advanced process-based modeling.Although Geographical Information System (GIS) software packages such as ArcGIS include various interfaces for implementing user-specific codes and models, many users prefer programming environments such as MATLAB that already include large libraries for different computational tasks.Since its release in 2010, the TopoToolbox, a code library for MATLAB, has been used in various studies of the Earth's surface and surficial water and material fluxes.Applications include topics such as supraglacial meltwater dynamics (Clason et al., 2012), contaminant transport in streams and groundwater (Messier et al., 2012), tectonic geomorphology (Shahzad and Gloaguen, 2011), soil nutrient dynamics (Schwanghart and Jarmer, 2011), karst hydrology (Borghi et al., 2011) or flood modeling (de Moel et al., 2012) Despite broad attention and positive feedback, the lack of a user-friendly graphical user interface (GUI) may also have discouraged interested users who favor a visual approach towards DEM processing and analysis.Moreover, processing very large DEMs, or, within a modeling framework, processing certain computations a large number of times, are common challenges in modern geomorphological studies and require efficient computational techniques.While very large DEMs are easiest handled with software that implements efficient input/output (I/O) communication between internal and external memory, a strategy pursued by ESRI's ArcGIS or more specialized DEM processing software such as terraflow (Arge et al., 2003), the memory constraint exerted by MATLAB's primary use of the main memory is an obstacle even for medium sized DEMs.Although spread of 64-bit computers has allayed the memory problem somewhat, MATLAB's heavy use of double precision data imposes too rigid limits for larger analyses and modeling tasks.
Here we introduce several important modifications and various extensions that come with the release of version 2 of the TopoToolbox.Specifically, we report the development of an object-oriented design towards grid, flow routing and stream network representation and give account of a suite of GUIs that provide easy access to a variety of new and existing methods frequently used in topographic studies.Our strategy to reduce memory constraints, which have been particularly pertinent to flow-related algorithms, enables much faster and memory efficient work flow and thus processing much larger DEMs than with previous versions of TopoToolbox.We think that these advances will encourage users to apply our algorithms in tool development and for advanced modeling purposes.

Object-oriented design
Gridded DEMs and terrain attributes incorporate a variety of information other than a gridded set of points.A DEM has physical units and is georeferenced, that is, it is associated with physical space by a set of geographical or map coordinates.In addition, Figures

Back Close
Full DEM derivatives (or terrain attributes) are tightly linked to algorithms and models and lend themselves for specific types of analysis.These task-and object-specific properties provide the basis for an object-oriented approach to DEMs.In object-oriented programming (OOP) data, attributes and procedures are coupled into objects that encapsulate the model of what each object represents (Register, 2007).Typical objects in DEM analysis are surface flow paths and the resulting stream networks.In TopoToolbox the aim of using OOP is to organize data and functions into classes with specific object-related attributes that organize and encapsulate information on spatial referencing, flow topology, and geometry, and thereby facilitate data handling and analysis.TopoToolbox 2 includes three main object classes: GRIDobj is a class to store and analyze gridded data (grid objects).FLOWobj is a class for flow-path networks (flow objects) that is derived from an instance of GRIDobj.STREAMobj represents the channelized fraction (stream objects) of the flow-path network from which it is derived.Additional object classes, such as SWATHobj, which contains swath profiles that are derived along directed linear features, e.g., an instance of STREAMobj, are more tool-specific and not as tightly coupled within TopoToolbox as the three main object classes.These classes are templates for the creation of specific instances of each class.Whereas an instance of GRIDobj simply contains the data grid as well as georeferencing data, instances of FLOWobj and STREAMobj implement a novel storage approach that represents the directed network of flow paths and stream networks, respectively.

A graph-theoretical representation of flow directions
Topography governs the transport mode and the magnitude of lateral material and water fluxes on the Earth's surface and in the near-surface underground.Among topographic variables, the flow direction is the most important because it forms the basis for many other flow-related topographic variables.Algorithms to derive flow directions are classified into single-neighbor and multiple-neighbor flow algorithms (Gruber and Peckham, 2009).Single-neighbor algorithms pass the flow from each cell to its lowest Introduction

Conclusions References
Tables Figures

Back Close
Full  1984).Multiple-neighbor algorithms, such as MFD (Quinn et al., 1991), D∞ (Tarboton, 1997), DEMON (Costa-Cabral and Burges, 1994), of the Mass-Flux Method (Gruber and Peckham, 2009), encompass a number of different approaches to model dispersive flow, which is particularly important to simulate water distribution on hillslopes.
TopoToolbox supports the SFD and MFD algorithms.In contrast to other GIS software, in the first version of TopoToolbox flow directions were stored in a sparse, weighted adjacency matrix to represent the flow network.While this strategy allows calculating flow accumulation and other flow related terrain attributes using MATLAB's builtin sparse matrix routines (Schwanghart and Kuhn, 2010), it also requires large memory space.The MFD and SFD matrix require approximately 6-and 2-times the memory space of the DEM, respectively, if all variables are stored in in the same data formats.
In the newly introduced flow direction class (FLOWobj), the storage of flow directions takes advantage of the fact that flow networks can be modelled as directed acyclic graphs (DAGs).Our approach is similar to MATLAB's sparse matrix storage organization but uses the "tuple" format, which is a collection of row, column, and value 3-tuples of the nonzero elements of the flow direction matrix (Kepner, 2011).The important difference is that row and column indices are stored in topologically descending order (Fig. 1), an approach which was recently adopted in a numerical landscape evolution model (LEM) (Braun and Willett, 2013) and a dynamic overland flow routing model (Huang and Lee, 2013).Topological sorting is only possible for DAGs and refers to the permutation of nodes that brings the flow direction matrix to a lower triangular form (Chen and Jacquemin, 1988).The storage of flow directions in topological order in a FLOWobj allows for easy coding and speeds up the computation of flow-related topographic attributes by about 500 %.Furthermore, the FLOWobj requires 89 % of the memory of the associated multiple flow direction matrix and 33 % of the single flow direction matrix (see benchmarks in Table 1).Because the nodes can be divided into independent subsets according to drainage basin affiliation (Fig. 1), they can be Introduction

Conclusions References
Tables Figures

Back Close
Full distributed to different processors, so that flow related terrain attributes can be evaluated in parallel, an important aspect for LEMs (Braun and Willett, 2013).In a topologically sorted FLOWobj, each grid cell's index ix appears before its downstream neighbor ixc if there is a directed link from ix to ixc (Fig. 1).For routing algorithms that simulate flow through the directed network, the topological order entails that each link or edge is only traversed once, which simplifies flow computations and decreases running time to O(n).For example, flow accumulations can be easily calculated by sequentially updating an initial weight raster A with rows × cols = n cells using the linear indices represented by the cells ix and their downstream neighbors ixc.
A = ones (row, cols); Note that the calculation is performed by in-place operations, i.e. the function input A is directly overwritten, which significantly reduces overhead memory of the algorithm.
The flow direction object (FLOWobj) can be created from an existing flow direction matrix (SFD or MFD) or a DEM.The latter is currently supported only for D8 flow routing, but allows users to simultaneously define if and how flow directions across flat terrain and topographic depressions are derived.Sinks and contiguous, flat areas in a DEM can be traversed using an auxiliary topography calculated by a gray-weighted distance transform algorithm (Soille et al., 2003).The resulting flow directions tend to correspond more closely to actual flow paths compared to those that are derived from a DEM that was hydrologically conditioned using "flood filling" (Poggio and Soille, 2011).Introduction

Conclusions References
Tables Figures

Back Close
Full

Further changes and enhancements
The main goal of TopoToolbox is to provide access to DEM analysis in form of functions that can be used as library in custom scripts or functions for advanced analyses or modeling purposes.Most functions available with TopoToolbox 1 are now methods associated with the new classes GRIDobj and FLOWobj (Table 2).Changes to calling syntaxes are few and were mainly made since the new classes encapsulate information such as cell size and spatial referencing in their properties, which previously had to be supplied to functions as additional input arguments.Thus, function syntaxes have become simpler and more intuitive.A new suite of functions was developed around the class STREAMobj and allows for creating, modifying and analyzing stream networks.Emphasis is placed on tools that facilitate the study of drainage networks and their relation to the tectonic setting, e.g., the analysis of longitudinal river profiles using slope-area plots (Wobus et al., 2006) or χ -plots (Harkins et al., 2007;Perron and Royden, 2013).
Performance increases were achieved with some of the flow related algorithms written in C-MEX code (Table 1).Computation speed is particularly significant when functions for calculating flow networks and accumulation are called repeatedly such as in numerical LEMs (e.g., Willgoose, 2005;Pelletier, 2008;Tucker and Hancock, 2010).While rivers act as major pathways of sediment and upstream migrating knickpoints in mountain environments, they encompass only a small portion of the entire landscape.
Accordingly, in LEMs the heterogeneous distribution of upslope areas leads to numerical solutions that require very small time steps to be numerically stable.Though implicit methods exist that relax the time step constraints (Fagherazzi et al., 2002;Braun and Willet, 2013), they fail to include the planform changes of river and flow network development, thus making frequent updating of the flow directions necessary.With its new implementation, TopoToolbox 2 can serve as a function library for the development of LEMs in MATLAB by providing fast executing codes in a programming language that already supports a large library of numerical tools.Introduction

Conclusions References
Tables Figures

Back Close
Full In most studies detailed topographic analyses are preceded by an initial visual exploration to familiarize with and assess the quality of a DEM, or to explore the results of model routines during coding.Furthermore, certain tasks are often easier and more rapidly accomplished through direct interaction with DEMs and their derivatives, as compared to writing and running scripts.Thus, TopoToolbox 2 now comes with several applications that allow usage and exploration of various toolbox functions with a graphical user interface (GUI).
The topoapp is an explorative tool for visual DEM analysis that provides rapid access to many basic and several advanced functions of the TopoToolbox 2. Importantly, topoapp is defined as an own object class that, when working on an instance of topoapp with the GUI, remains in the workspace and is constantly updated with every action of the user.Additionally, it was written in a way that allows users to add their own functions or modules to it and therefore provides an expandable platform for displaying the graphical outcomes of DEM analysis with the TopoToolbox and other MATLAB tools.With the currently embedded functions, users can quickly and easily extract and plot simple profiles, entire drainage networks or subsets of it, watershed boundaries, and individual channel reaches.The created features can be used to build swath profiles, subset the DEM, or compute simple catchment statistics, amongst other options.Depending on the availability of MATLAB's Mapping Toolbox or other existing, freely available MAT-LAB functions, all created objects can be exported as shapefiles or kml-files.
Manual editing of DEMs with spurious sinks is often required to produce hydrologically correct DEMs.Although automated ways to distinguish between actual and spurious sinks exist (Lindsay and Creed, 2006), choosing which sinks should be filled, carved or retained may be preferred and requires visual interpretation of the data and results.The new preprocessapp enables a combination of automatic and manual hydrological correction of a DEM by providing interactive tools to fill topographic depressions or carve along least-cost paths to breach features that obstruct digital flow paths.The flowpathapp is a tool to map individual streams or a stream network by interactively Introduction

Conclusions References
Tables Figures

Back Close
Full setting channelhead locations and the slopeareatool provides an interactive tool to study slope-area relationship for individual streams or stream networks.

Conclusions
With the release of version 2, the TopoToolbox for MATLAB has become a more memory efficient, faster and more user-friendly tool for digital terrain analysis.The main difference to the previous version is the adoption of an object-oriented representation of grids, flow direction and stream networks.Topological ordering reduces the memory bottleneck of the previous, sparse matrix approach to flow direction while increasing computation speed and allowing parallel computing.Software quality and particularly reusability are improved so that TopoToolbox can be used as a framework for implementing dynamic, hydrological and geomorphological models.Finally, newly introduced, interactive tools will not only be valuable for researchers to perform rapid analysis but also for conveying and exploring the richness of Earth surface processes in classrooms or labs.

Supplementary material related to
Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | neighboring cell (usually referred to as SFD or D8 algorithm, O'Callaghan and Mark, Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | Discussion Paper | this article is available online at http://www.earth-surf-dynam-discuss.net/1Discussion Paper | Discussion Paper | Discussion Paper | Tarboton, D. G.: A new method for the determination of flow directions and upslope areas in grid digital elevation models, Water Resour.Res., 33, 309-319, doi:10.1029/96WR03137,1997.Tucker, G. E. and Hancock, G. R.: Modelling landscape evolution, Earth Surf.Proc.Land., 35, 28-50, doi:10.1002/esp.1952,2010Discussion Paper | Discussion Paper | Discussion Paper |

Fig. 1 .
Fig. 1.D8 flow network.Numbers in cells refer to the order after a topologically sorting.Cell colors indicate different drainage basins.

Table 2 .
Selection of object-specific methods and functions.