NAME

r.in.bin - Import a binary raster file into a GRASS raster map layer.
(GRASS Raster Data Import Program)

SYNOPSIS

r.in.bin
r.in.bin help
r.in.bin [-s] [-f] [-b] [-h] input=name output=name bytes=value [title="phrase"] [north=value ] [south=value ] [east=value ] [west=value ] [r=value] [c=value ] [subst=old,new]

DESCRIPTION

r.in.bin allows a user to create a (binary) GRASS raster map layer from a variety of binary raster data formats.

OPTIONS

Flags:

-s
Signed data (high bit means negative value)
-f
Import the data to a Float type GRASS raster map layer (default is Integer)
-b
Byte swap the binary data during import. This includes the header if -h specified.
-h
Read region information from a Generic Mapping Tools (GMT) type binary header.
Is compatible with GMT binary grid types 1 and 2.

Parameters:

input=name
Name of an existing binary raster file to be imported.
output=name
Name to be assigned to resultant GRASS raster map layer.
bytes=value
Number of bytes per cell (2, 4, 8)
title="phrase"
Title to be assigned to resultant raster map layer.
north=value
Northern limit of geographic region
south=value
Southern limit of geographic region
east=value
Eastern limit of geographic region
west=value
Western limit of geographic region
r=value
Number of rows
c=value
Number of columns
subst=val
Substitute val with NULL
The north, south, east, and west field values entered are the coordinates of the edges of the geographic region. The rows and cols field values entered describe the dimensions of the matrix of data to follow. These six fields are not required if input is a GMT binary array, with flag -h. If the bytes field is entered incorrectly an error will be generated suggesting a closer bytes value.

r.in.bin can be used to import numerous binary arrays including: etopo30, etopo-5, Globe DEM, BIL, and GMT binary arrays (ID 1 & 2)

EXAMPLE

The following is a sample call of r.in.bin to import GTOPO30 DEM data:

r.in.bin -s input=E020N90.DEM output=gtopo30 bytes=2 north=90 south=40 east=60 west=20 r=6000 c=4800

(you can add "subst=-9999" if you want sea level to have a NULL value)

The following is a sample call of r.in.bin to import a GMT type 1 (float) binary array:

r.in.bin -hf input=sample.grd output=sample.grass bytes=4

(-b could be used to swap bytes if required)

NOTES

The geographic coordinates north, south, east, and west describe the outer edges of the geographic region. They run along the edges of the cells at the edge of the geographic region and not through the center of the cells at the edges.

Notes on (non)signed data:

If you use the -s flag the highest bit is the sign bit. If this is 1 the data is negative, and the data interval is half of the unsigned (not exactly). For example:

Data: 2 byte
Unsigned interval: 0x0000 -> 0xFFFF = 0 -> 65535 decimal = 00000000 00000000 ->11111111 11111111 binary.
Signed interval: 0x8000 -> 0xFFFF; 0x0000 -> 0x7FFF = -32768 -> -1; 0 -> 32767 = 10000000 00000000 -> 11111111 11111111; 00000000 00000000 -> 01111111 11111111 binary.

This is the 2's complement representation.
So if the data 1 byte the integer range is -128 -> 127, if 2 byte (16 bit, word) -32768 -> 32767, if 4 byte (32 bit, doubleword, Dword) -2^31 -> 2^31-1. And of course the value zero has a positive sign.

SEE ALSO

r.out.bin, r.in.ascii, r.out.ascii, r.in.arc, r.out.arc

AUTHORS

Jacques Bouchard, France (bouchard@onera.fr)
Bob Covill, Canada (bcovill@tekmap.ns.ca)
Man page: Zsolt Felker (felker@c160.pki.matav.hu)