Introducing QuickChi, a web application for near-global, exploratory, longitudinal river profile analysis

Stream profile analysis has been used extensively in the field of tectonic geomorphology. In the past, exploration of stream profiles, including χ-elevation profiles, has required downloading and processing Digital Elevation Models for specific areas, which limits the scope of exploratory analysis. Presented here is a web application designed to analyze stream profiles at 90m resolution at a near-global scale. Based on the Hydrosheds (Wickel et al., 2007) 90m drainage direction, as well as computed d8 drainage direction and void-filled DEMs, the app allows users to quickly query downstream from selected points anywhere within ±60 degrees latitude, in order to interactively analyze corresponding stream profiles in both distance and χ space, where χ is a metric that is proportional to the presumed steady-state shape of the stream profile (Perron and Royden, 2013). QuickChi is open source, and although currently it is designed as an exploratory tool, more functions can be easily added via community contributions and/or from existing toolsets.


Introduction
Rivers are often thought to respond to tectonic perturbations by propagating signals upstream, and longitudinal stream profile analysis has become increasingly important for understanding the coupling of tectonics and surface processes (e.g., Hack, 1973;Whipple and Tucker, 1999, Wobus et al., 2006, Perron and Royden, 2013, Ferrier et al., 2013, Willett et al., 2014, Beeson and McCoy, 2020.
River profile analysis became more popular with the advent of widely accessible global digital elevation models (DEMs) (eg. SRTM, Farr and Kobrick, 2000). Initially released globally from -60 to 60 degrees latitude at 90m resolution, several different processed forms of Shuttle Radar Topography Mission (SRTM) data were released in the early to late 2000s (e.g. Hydrosheds, Wickel et al., 2007 as tiles, which requires GIS processing on the user's end in order to merge tiles perform further processing.
Several toolboxes have emerged to perform processing and topographic analysis on DEMs (Whipple et al., 2007, Shahzad et al., 2011, Schwanghart and Scherler, 2014, Forte and Whipple, 2019, Clubb et al., 2019. However, the time-consuming nature of downloading and processing DEMs restricts exploratory efforts to analyze stream profiles across the globe. QuickChi is a simple application that can precede more in-depth analysis with the aforementioned existing toolboxes, by allowing users to explore areas of potential interest at a near-global scale.

Theory of χ based stream profile analysis
A large portion of river profile analysis is built on the stream power equation (e.g. Howard et al., 1994;Whipple and Tucker 1999). Stream power is a nonlinear advection equation solving for topographic change within the river network: where dz/dt is the rate of change in surface elevation, U is (typically tectonic) uplift rate, k is an advection coefficient, A is upstream drainage area at a given point, dz/dx is an approximation of local slope, and m and n provide the scaling relationship for drainage area, slope, and erosion rate.
The steady state profile for the stream power equation can be solved assuming that dz/dt = 0, i.e. that uplift rate balances fluvial incision rate: which, when integrated solving for z gives the steady state solution for the elevation of the river profile z0 = ∫ U 1/n / (k 1/n A m/n ) dx (3) U and k are often assumed to be spatially uniform, and frequently we are only interested in how the steady state elevation scales with the river profile. Therefore the choice of U and k have no influence on the shape of χelevation plots in this case, and are frequently set to unity. The resulting value for χ is a discretized function which is linearly proportional to the above integral, summing upstream along each cell within the DEM from a given starting elevation downstream: where A0 is a scaling area that gives χ units of length (e.g. Willett et al., 2014), and iterates upstream along dem cells Δx distance apart. χ-elevation analysis is a relatively recent development that has become a robust tool for interpreting tectonic signals within river networks. When a longitudinal river profile is plotted against χ, the resulting graph should be linear if the stream profile is at steady state and the ratio m/n is appropriately chosen.
Any deviations from steady state may appear as breaks in this linear slope (e.g. Beeson and McCoy, 2020).
Deviations are sometimes referred to as knickpoints, which are often transient responses to downstream tectonic perturbations.

Methods
QuickChi data was produced using standard methods for DEM processing and analysis. I briefly describe these methods below.

Flow routing
To extract stream profiles, QuickChi currently uses the Hydrosheds flow direction grid as the default method for flow routing. Hydrosheds provides a unidirectional flow routing grid produced from a hydrologically conditioned DEM, which means that the mapped location of rivers have been "burned" into the DEM in order to force the flow routing algorithm down the rivers' observed path. Although the river path based on the hydrologically conditioned DEM often match well with mapped river locations, the Hydrosheds conditioned DEM is not suitable for extracting the topography of the rivers along their path because the process of stream burning often erases tectonic signals from the river network. Therefore, the Hydrosheds void-filled (nonhydrologically-conditioned) DEM is used for the river topography.
As an alternative to the Hydrosheds flow routing, I also provide a "d8" flow routing grid produced by filling pits and basins within each continent using the method of Barnes et al., (2014) (see code for the implementation) and routing down the path of steepest descent. Although this works well for high, steep, topography, the flow routing becomes less accurate around lower, flatter areas such as continental interiors and coastal plains, and particularly in intracratonic basins, and therefore Hydrosheds flow routing is recommended for these areas. This is because Hydrosheds has been explicitly tuned so that flow is routed along observed locations large streams, whereas the d8 method simply routes down the steepest descent path of the pit-filled SRTM grid.

Drainage accumulation
A drainage accumulation grid (A in eq. 4) was pre-built by using the Fastscape method (Braun and Willett, 2013; see the GlobalStack repository for the implementation). In order to ensure river connectivity, each continent was processed continuously. The processed accumulation grids for each continuous continent (Eurasia, Africa, Australia, North America, South America) are provided at the links listed in the footnotes.

Topography and χ processing
Although pit-filled DEMs were created to produce the d8 flow routing grid, the pit-filled DEMs have no further use in QuickChi. Instead, the topography is extracted from the original DEM, even when using d8 flow routing.
This results in what appears to be topographic noise along the river profile (e.g., the depression at the cursor location in Figure 1). The pits are not filled in order to help users to distinguish between real knickpoints in the river and those that might have been produced by the pit-filling algorithm over noise, basins, dams, or natural variations in streambed elevation. However, in large, flat rivers, the noise can be significant and detract from the overall signal of the river. A 1D Gaussian filter is therefore employed with an optional smoothing window size (in units of standard deviations), as implemented by the SciPy package (SciPy.org).
Additionally, in order to limit data that needs to be rendered by the web-based plots, the elevation and distance data are interpolated to a maximum of 1000 data points. Similarly, the χ-elevation profiles are interpolated down to a maximum of 1000 data points. The raw, un-interpolated elevation data can still be downloaded by the user, however.
The χ calculation of eq. 4 is done after the stream is selected. Once a user selects a river, drainage area and distances are extracted along the river network, and an integral sum is performed upstream from the lowest elevation selected by the user. Due to the relatively low computational cost of this method even for extremely long rivers, multiple m/n (theta) values are calculated simultaneously and sent to users for comparison.

User interface
Users select the headwaters from an OpenTopography map (www.OpenTopography.org). The stream is then computed based on the selected flow routing dataset. When stream computation is completed, the page will reload with an elevation profile of the river. The river profile is displayed with an interactive plot, along which users move their cursor and show the corresponding location on the map (Figure 1).
Users can also view a χ-elevation plot. An interactive graph will display showing the χ-elevation profile of their river as generated by the Altair Python package (https://altair-viz.github.io/). These interactive graphs can be downloaded and shared for display in most browsers. As outlined above, the χ-elevation plot should appear linear for a steady state river if an appropriate m/n value is chosen. The user can select an appropriate theta (m/n value) at an interval of 0.1 within the range 0.25 -0.65 for their plot using the sliding bar at the bottom of the graph. The user can also select a subset of the χ-elevation profile to be displayed in the bottom panel by dragging their cursor along the area of interest in the top panel. (Figure 2).
Finally, a user can download the data for their select river for further processing in GIS or for programming. In particular, the user can export a GeoJSON file of the river path to load in most GIS programs.

Discussion
QuickChi can be used as an app to explore global river profiles, and is ideal for both research and educational purposes. It was designed to have a simple interface with a limited number of functions for ease of use, and to limit hardware requirements of hosting servers. However, for this reason, the methods employed are less robust than those of stand-alone toolboxes for stream profile analysis (e.g., Schwanghart and Scherler, 2014;Forte andWhipple, 2019, Clubb et al., 2019). QuickChi is therefore designed to supplement these toolboxes by allowing users to explore areas of interest before downloading DEMs and performing more in-depth analyses.

Data quality
DEMs were downloaded as 16-bit integers, which means that there is at least 0.5m uncertainty in the elevation at any given point. Additionally, the DEM data is presented in its raw void-filled form, instead of the pit-filled DEMs that are produced to make the d8 flow direction grid. As stated previously, users must take the choice of a flow routing with consideration for the area of interest: The d8 grid will not be accurate on low, flat, topography, while Hydrosheds may be less accurate in some areas of high topography. Additionally, SRTM has been known to be inaccurate in areas where there may be significant radar "shadowing" from topography, i.e. extremely deep canyons (Grohman, 2018). Hydrosheds has attempted to interpolate these voids, but users should be cautious about extracting profiles in these areas and take note of anamalous topography, particularly in areas such as the Himalaya where anamalous spikes in SRTM data can be readily identified. A recent assessment of elevation data in the Indian Himalaya found that SRTM may not have acceptable accuracy for many studies with standard error typically > 10m (Mukul et al., 2017).

Practical considerations
QuickChi sends and receives limited information at a time -downloading data for the longest rivers (e.g., the Nile) is at most 6 MB. The largest practical problem to overcome with a global stream profiler is the size of the datasets, which are too large to be loaded into computer memory on most servers. Fortunately, modern solidstate drives are sufficiently fast that most datasets can be memory-mapped with limited slowdown. The current implementation is hosted on Amazon AWS in Frankfurt, Germany with the "i3en.large" configuration: 2x vCPUs @ 3.1 GHz, 16 GB memory, 1250 GB SSD storage, and 25 GB/s network bandwidth. The longest time to extract a single river and topography under no other server load was 35 seconds for the entire Nile river.
However, extraction is much faster if users select another, nearby river, because the nearby river information has already been loaded into memory.
To prevent server overload, the app has been set to deny more users if the number of queries exceeds 50 within 5 minutes. However, QuickChi was designed to be easy to set up. If demand becomes great enough, more hosts can be added easily.

Future plans
Although QuickChi was designed to have a simple interface with limited server load, it is possible that new functions can be added in the future. Community input for new functionality is welcome. Additionally, Hydrosheds v2.0 is slated to be released in the near future (Lehner et al., 2021), which will include areas for the entire globe outside the 60 degree latitudes, and will be included in QuickChi upon release.

Conclusions
Presented here is a web application which makes use of global river data to allow for rapid, near-global river profile analysis in χ-space for exploratory purposes. Although the QuickChi interface is simple, it may serve as a powerful tool for those who are exploring and are not yet ready to perform in-depth analysis with a standalone toolbox, and for educators. The Python-based design is robust and may allow for the inclusion of additional tools in the future.

Code Availability
The stream profiler app is available for use from https://streamprofilerapp.github.io/ . The source code is available at https://github.com/streamprofilerapp/streamprofilerapp . Custom functions made for processing the DEMs are provided at https://github.com/streamprofilerapp/globalstack

Data Availability
Data grids used on the server are available from google drive on the link in the GitHub repository.

Competing Interests
The author declares that they have no conflict of interest.