Skip to content

r3.in.bin

Imports a binary raster file into a GRASS 3D raster map.

r3.in.bin [-rdis] input=name output=name bytes=integer [order=string] north=float south=float east=float west=float bottom=float top=float rows=integer cols=integer depths=integer [null=float] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r3.in.bin input=name output=name bytes=integer north=float south=float east=float west=float bottom=float top=float rows=integer cols=integer depths=integer

grass.script.run_command("r3.in.bin", input, output, bytes, order="native", north, south, east, west, bottom, top, rows, cols, depths, null=None, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("r3.in.bin", input="name", output="name", bytes=integer, north=float, south=float, east=float, west=float, bottom=float, top=float, rows=integer, cols=integer, depths=integer)

Parameters

input=name [required]
    Name of binary 3D raster file to be imported
output=name [required]
    Name for output 3D raster map
bytes=integer [required]
    Number of bytes per cell in binary file
    Allowed values: 1, 2, 4, 8
order=string
    Byte order in binary file
    Allowed values: big, little, native, swap
    Default: native
north=float [required]
    Northern limit of geographic region (outer edge)
south=float [required]
    Southern limit of geographic region (outer edge)
east=float [required]
    Eastern limit of geographic region (outer edge)
west=float [required]
    Western limit of geographic region (outer edge)
bottom=float [required]
    Bottom limit of geographic region (outer edge)
top=float [required]
    Top limit of geographic region (outer edge)
rows=integer [required]
    Number of rows
cols=integer [required]
    Number of columns
depths=integer [required]
    Number of depths
null=float
    Set Value to NULL
-r
    Switch the row order in output from north->south to south->north
-d
    Switch the depth order in output from bottom->top to top->bottom
-i
    Binary data is of type integer
-s
    Signed data (two's complement)
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

input : str, required
    Name of binary 3D raster file to be imported
    Used as: input, file, name
output : str, required
    Name for output 3D raster map
    Used as: output, raster_3d, name
bytes : int, required
    Number of bytes per cell in binary file
    Allowed values: 1, 2, 4, 8
order : str, optional
    Byte order in binary file
    Allowed values: big, little, native, swap
    Default: native
north : float, required
    Northern limit of geographic region (outer edge)
south : float, required
    Southern limit of geographic region (outer edge)
east : float, required
    Eastern limit of geographic region (outer edge)
west : float, required
    Western limit of geographic region (outer edge)
bottom : float, required
    Bottom limit of geographic region (outer edge)
top : float, required
    Top limit of geographic region (outer edge)
rows : int, required
    Number of rows
cols : int, required
    Number of columns
depths : int, required
    Number of depths
null : float, optional
    Set Value to NULL
flags : str, optional
    Allowed values: r, d, i, s
    r
        Switch the row order in output from north->south to south->north
    d
        Switch the depth order in output from bottom->top to top->bottom
    i
        Binary data is of type integer
    s
        Signed data (two's complement)
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

r3.in.bin allows a user to create a GRASS 3D raster map from a variety of binary 3D raster data formats.

The top, bottom, north, south, east, and west field values entered are the coordinates of the edges of the geographic region. The depths, rows and cols field values entered describe the dimensions of the matrix of data to follow. If the bytes field is entered incorrectly an error will be generated suggesting a closer bytes value.

NOTES

The write order of the rows (north->south to south->north) and the write order of the depths (bottom->top to top->bottom) can be switched.

Have a look at r3.out.ascii to manual page that describes the internal layout of the 3D raster maps and the supported row and depth switch options.

Import of little and big endian byte order as well as signed and unsigned integer data types is supported.

EXAMPLES

First we create a specific region and a 3D raster map that we will export with r3.out.bin and import again.

g.region w=0 e=180 s=0 n=90 b=0 t=100 res3=10
r3.mapcalc expr="test_out_bin_float = float(if(row() == 2, null(), row()))"

r3.out.bin input=test_out_bin_float byte=4 null=-9999 \
    output=test_out_bin_float_native_b4.bin order=native

r3.in.bin output=test_in_bin_float byte=4 null=-9999 \
    input=test_out_bin_float_native_b4.bin order=native \
    bottom=0 top=100 west=0 east=180 south=0 north=90 \
    cols=18 rows=9 depths=10

SEE ALSO

r3.out.bin, r3.in.ascii, r3.out.ascii

AUTHORS

Soren Gebbert, based on r.in.bin from Jacques Bouchard and Bob Covill

SOURCE CODE

Available at: r3.in.bin source code (history)
Latest change: Friday Feb 07 19:16:09 2025 in commit a82a39f