## 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 ] [anull=value]

## 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 one byte data (range -128 - 127). Interpret high bit (> 127) as a 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 (1, 2, 4)
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
anull=value
  Set Value to 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. If input is a GMT binary array (-h flag), the six dimension fields are obtained from the GMT header. 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, AVHRR 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 "anull=-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`

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

The following is a sample call of r.in.bin to import an AVHRR image:

`r.in.bin in=p07_b6.dat out=avhrr c=128 r=128`

## NOTES

If optional parameters are not supplied, r.in.bin attempts to calculate them. For example if the rows and columns parameters are not entered, r.in.bin automatically calculates them by subtracting south from north and west from east. This will only produce correct results if the raster resolution equals 1. Also, if the north, south, east, and west parameters are not entered, r.in.bin assigns them from the rows and columns parameters. In the above AVHRR example, the raster would be assigned a north=128, south=0, east=128, west=0.

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).

This flag is only used if bytes= 1. If bytes= is greater than 1 the flag is ignored.

## SEE ALSO

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

## AUTHORS

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

Last changed: $Date: 2002/03/01 00:08:31 $