New package automates river relative elevation model (REM) generation

Aug 10, 2022

Relative elevation model (REM) of Birch Creek, a tributary to the Yukon River, Alaska, USA.

Relative elevation model (REM) of Birch Creek, a tributary to the Yukon River, Alaska, USA. (NW to the left)

Introduction: DEM vs. REM

Topographic data are often represented in the form of a digital elevation model (DEM), where an elevation value is defined at each pixel in a rectangular grid. Spatially, the grid is defined with respect to a local (or geographic) coordinate system, and elevation values are given with respect to a particular datum (typically sea level).

Because rivers flow downhill, DEMs of river corridors will always have a decreasing trend in elevations from the upper headwater streams down to an outlet such as an ocean or terminal basin. Superimposed on this overall trend are smaller-scale topographic variations in the river corridor. These fluctuations in topography interact with the river hydraulics, which in turn control where sediment moves, thus adjusting the topography and creating a feedback process between topography and hydraulics (see: river morphodynamics).

In fluvial geomorphology (the study of the physical shape/structure of rivers), the topography of a river corridor can provide valuable insights regarding the processes that govern the evolution of the river over time. For example, low points adjacent to the main channel are often abandoned, creating relic channels in meandering rivers. One technique used to study these topographic variations is the creation of a relative elevation model, or REM. An REM is created by removing the overall downward trend in river elevation, leaving behind the local fluctuations in topography relative to the river. REMs serve as a simple (and often aesthetically pleasing) means to visualize river corridors and floodplains. REMs have also been used in applications such as machine learning models to predict river substrate size classes


detrend example

An example river centerline elevation profile (top) and the residual relative elevations (bottom) after removing the large-scale trend in slope. This detrending for the lower Yuba River was originally developed to study river landform sequences.

How to Create a REM

Detrending a DEM to create an REM involves three main steps:

  1. Sampling elevation values along a river centerline;  
  2. interpolating the sampled river elevations across the DEM extent to get the nearest river elevation at every pixel; and
  3. subtracting these values from the original DEM. The end result is an REM where a value of 0 corresponds to areas at the same elevation as the nearest portion of the river channel, and positive values representing the local height above the river channel.

While the overall method is typically the same, there are several different ways of accomplishing each step in the process of producing a REM. The river centerline used can be manually drawn, or it can be explicitly calculated with more complex topographic methods such as least cost path analysis or flow accumulation. A channel cross-section sampling can also be used as an alternative approach. Depending on whether the topographic data covers the river bathymetry (e.g. sonar or green lidar) or not (near infrared lidar), the river elevation sampled will either correspond to the river bed elevation or water surface elevation, respectively. Detrending can also be based on a functional fit of bed elevations in order to emphasize in-channel topographic fluctuations. Interpolation methods used to determine the nearest river elevation across the DEM include nearest neighbor, inverse distance weighting, Kriging, and others. Each of these methods has their own parameters that can lead to differing results in the final output. Consequently, producing REMs is typically a manual, iterative process.

Generating REMs usually takes some manual steps and iteration in order to generate a good looking final product. The gold standard are the tutorials produced by Daniel Coe of the Washington Geological Survey.

Although for optimum cartographic presentation, manual intervention is required, the OpenTopography team is always interested in automating data processing to the greatest extent possible. Thus, we're happy to announce a new Python package that automates REM creation from nothing but an input DEM. The methods used by this package are outlined below.

  • Get river centerline geometries: OpenStreetMap provides a large set of river centerline geometries based on several underlying datasets and user contributions across the globe. Furthermore, rivers that are not listed on OpenStreetMap can be added by users. A wrapped OpenStreetMap API query on the area covered by the DEM is used to retrieve the centerline of the largest river within the DEM area.
  • Sample points along centerline: Evenly spaced points are then sampled along the river centerline. The DEM elevations at each of these points will be used to define the local river elevation, and nearby elevations in the REM will be relative to these values. Below is an example of an REM with the centerline and sample points used to create it shown in red.

The Milk River in Montana, USA.

           The Milk River in Montana, USA.

  • Interpolate: In order to define the local river elevation at each point on the DEM, the elevation at each of the sampled points is interpolated across the entire area of the DEM. Rather than just using the nearest sample point to define the local river elevation, an Inverse Distance Weighting (IDW) is used in order to get a weighted average of multiple nearby river elevations, resulting in a smoother output surface.
  • Detrend: Interpolated river elevations are subtracted from the original DEM elevations at each pixel in order to get the REM. Thus, REM values are the elevations relative to local river elevation. For example, a value of zero in the REM corresponds to an elevation at the level of the river, and a value of 10 would be 10 elevation units above the river.
  • Apply coloring and visualize: To visualize the REM, we can apply a color mapping to the REM values. In order to emphasize elevation differences very close to the river, where relevant features like relic channels, scroll bars, and floodplains are present, we apply a colormap that scales with the logarithm of REM elevations. That way, more color variation is present closer to the river channel. This colored REM is also blended with a hillshade in order to further emphasize topographic differences.

Create your own REM

To start creating your own REMs, download a DEM from OpenTopography and install the RiverREM Python package


The RiverREM package was developed by Kenneth Larrieu during summer 2022, with support from OpenTopography, and the UNAVCO Student Internship Program. See the RiverREM Github repository for more information.

Beaver Creek, a tributary to the Yukon River, Alaska, USA

Beaver Creek, a tributary to the Yukon River, Alaska, USA.

Neches River, Texas, USA.

Neches River, Texas, USA. (North to the left)

The Dirty Devil River in Utah, USA.

The Dirty Devil River in Utah, USA.