RiverTools Grid (RTG) Format

RiverTools Grids (RTG) are binary files with no header that store a 2D array (or grid) that is the same size as the DEM (*_DEM.rtg) they were derived from. Their dimensions, georeferencing and other information are identical to the DEM, except possibly for their data type. Values in the file are stored in row major order; that is, values for the first (north) row are followed by values for the second row, and so on. The filesize for an RTG file is always equal to the product:

filesize = (ncols x nrows x BPE)

where BPE is the number of Bytes Per Element in the 2D array. The possible data types for an RTG file are `BYTE', `INTEGER', `LONG', `FLOAT', and `DOUBLE'. The corresponding values of BPE are 1, 2, 4, 4, and 8. Each RTG file has a data type that is appropriate for the range of possible values that array can contain. This use of the most "economical" data type results in more efficient use of disk space and faster access times. Given the number of rows and columns in the DEM (nrows and ncols), the data type of an RTG file can be deduced from its filesize in all cases except when BPE is equal to 4. In this case, the data type could be either LONG or FLOAT, and additional information is required in order to determine which one. A standard, recognized filename extension is one method for deciding between these two data types.

Routines in the Extract menu create RTG files from other RTG files, such as the initial DEM (*_DEM.rtg). For example, the Extract -> Flow Grid routine will create a copy of the DEM with the extension "_rawDEM.rtg" which it will leave unaltered, and will then fill depressions in the file with extension "_DEM.rtg". This routine will then go on to create a D8 flow grid with extension "_flow.rtg" from the depressionless DEM grid. This D8 flow grid is then used by other routines in the Extract menu to create additional RTG files.

Attribute File Extension Data Type
Area "_area.rtg" FLOAT or LONG
Curvature "_curv.rtg" FLOAT
Elevation "_DEM.rtg" any type
DInf Flow Angle "_dinf.rtg" DOUBLE
DInf Area "_dinfarea.rtg" DOUBLE
DInf Slope "_dinfslope.rtg" DOUBLE
Flow Distance "_FD.rtg" FLOAT
D8 Flow Codes "_flow.rtg" BYTE
Imposed grad. DEM "_imposed_DEM.rtg" FLOAT
Number of D8 Kids "_nkids.rtg" BYTE
HS Stream Order "_order.rtg" BYTE
Raw Elevations "_rawDEM.rtg" any type
Watershed units "_sides.rtg" LONG
Local D8 slope "_slope.rtg" FLOAT
Topo. index "_TI.rtg" FLOAT
Pit basin mask "_TMPmask.rtg" LONG

There are several RiverTools commands that can be used for working with RTG files. These require access to the IDL command line, which is available with the RiverTools+IDL combination but not with RiverTools itself. These include:

  • RT_Read_Grid
  • RT_Check_Grid_Type
  • RT_Read_Subgrid
  • RT_Write_Subgrid
  • RT_Read_RTM_As_Grid
  • RT_Get_Available_DEMs
  • RT_Get_Available_Grids

These are fully documented in the RiverTools Command Reference, which can be downloaded from the Downloads page. The Extract menu also provides access to many routines for creating RTG files.


Copyright (c) 1998-2008, Rivix, LLC. All rights reserved.