RiverTools Grid (RTG) Format
RiverTools Grid (RTG) are binary files with no header that store a 2D array (or grid) whose size 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 following 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, DOUBLE, LONG64, UINT, ULONG and ULONG64. The corresponding values of BPE are 1, 2, 4, 4, 8, 8, 2, 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 often be deduced from its filesize. A notable exception is 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. There is also a text file called lon_list.txt in the RiverTools resource folder that contains filename extensions for RTG files that have the (less common) LONG data type. For example, this list includes the extension: "_mask.rtg". You can add other extensions to this file as necessary.
Beginning in RiverTools 4.0, any RTG file can have its own RTI file where the filename is identical except for replacing ".rtg" with ".rti". If present, this file is always examined first to determine the data type. Some of the extraction routines that produce RTG files also produce a matching RTI file.
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 dialog 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. For example, the following table shows some of the more commonly used RTG files.
* Note: MFM stands for the Rivix Mass Flux Method.
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:
These are fully documented in the RiverTools Command Reference. The Extract menu also provides access to many routines for creating RTG files.
Copyright (C) RIVIX, LLC. 1998-2021