r.in.bin(1)
π r.in.bin β NAME π
okay so bestie, welcome to the r.in.bin(1) page from the GRASS GIS User's Manual β¨ this one's a lil legend: she takes your random binary raster file and turns it into an actual GRASS raster map layer. main character energy, no cap π
r.in.bin β Import a binary raster file into a GRASS raster map layer.
π·οΈ KEYWORDS
raster, import β that's the whole vibe check right there, she's a raster importer periodt π
π SYNOPSIS
r.in.bin
r.in.bin --help
r.in.bin [-fdsbh] input=name output=name [title=phrase]
[bytes=integer] [header=integer] [bands=integer] [order=string]
[north=float] [south=float] [east=float] [west=float]
[rows=integer] [cols=integer] [anull=float]
[flip=string[,string,...]] [--overwrite] [--help] [--verbose]
[--quiet] [--ui]
π© Flags
-fβ import it as floating-point data (the default is integer, just so you know π)-dβ import it as double-precision floating-point data (again, default is integer)-sβ signed data, as in two's complement π-bβ byte swap the data while importing, she's flipping those bytes around-hβ grab the region info from a GMT style header--overwriteβ let the output files overwrite files that already exist--helpβ print the usage summary--verboseβ verbose module output, she tells you everything--quietβ quiet module output, she tells you nothing--uiβ force launching the GUI dialog
ποΈ Parameters
input=name[required] β name of the binary raster file you wanna importoutput=name[required] β output name, or a prefix if you're importing several bandstitle=phraseβ title for the resultant raster mapbytes=integerβ number of bytes per cell. Options:1,2,4,8header=integerβ header size in bytes. Default:0bands=integerβ number of bands in the input file. Heads up: bands must be in band-sequential order. Default:1order=stringβ output byte order. Options:big,little,native,swap. Default:nativenorth=floatβ northern limit of the geographic region (that's the outer edge, bestie)south=floatβ southern limit of the geographic region (outer edge again)east=floatβ eastern limit of the geographic region (outer edge, yes)west=floatβ western limit of the geographic region (outer edge, mhm)rows=integerβ number of rowscols=integerβ number of columnsanull=floatβ set value to NULLflip=string[,string,...]β flip the input horizontal and/or vertical. Options:h,vh: flip input horizontal (East - West)v: flip input vertical (North - South)
πΈ DESCRIPTION
r.in.bin lets you create a (binary) GRASS raster map layer out of a whole bunch of different binary raster data formats. she's versatile like that π
The -s flag is the one you use for importing two's-complement signed data.
The -h flag is for reading region information out of a Generic Mapping Tools (GMT) type binary header. It's compatible with GMT binary grid types 1 and 2.
The north, south, east, and west field values are the coordinates of the edges of the geographic region. The rows and cols values describe the dimensions of the matrix of data that's coming next. If your input is a GMT binary array (that's the -h flag, iykyk), then all six dimension fields (north, south, east, west, rows and cols) get pulled straight from the GMT header. And if you enter the bytes field incorrectly, an error gets generated suggesting a closer bytes value β she'll help you out π«Ά
r.in.bin can be used to import a whole lineup of binary arrays, including: ETOPO30, ETOPO-5, ETOPO-2, Globe DEM, BIL, AVHRR and GMT binary arrays (ID 1 & 2).
π NOTES
If optional parameters aren't supplied, r.in.bin attempts to calculate them herself. For example, if the rows and columns parameters aren't entered, r.in.bin automatically calculates them by subtracting south from north and west from east. Careful though β this only produces correct results if the raster resolution equals 1. Also, if the north, south, east, and west parameters aren't entered, r.in.bin assigns them from the rows and columns parameters. In the AVHRR example (peep it below), 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. important distinction, bestie π―
- Eastern limit of geographic region (in projected coordinates must be east of the
westparameter value, but in geographical coordinates will wrap around the globe; user errors can be detected by comparing theewresandnsresvalues of the imported map layer carefully). - Western limit of geographic region (in projected coordinates must be west of the
eastparameter value, but in geographical coordinates will wrap around the globe; user errors can be detected by comparing theewresandnsresvalues of the imported map layer carefully).
π’ Notes on (non)signed data
- If you use the
-sflag, the highest bit is the sign bit. If this is1, the data is negative, and the data interval is half of the unsigned (not exactly). - This flag is only used if
bytes=1. Ifbytesis greater than1, the flag is ignored.
π₯ EXAMPLES
ποΈ GTOPO30 DEM
Here's a sample call of r.in.bin to import GTOPO30 DEM data:
r.in.bin -sb 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 π)
π GMT
Here's 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)
π°οΈ AVHRR
Here's 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
π ETOPO2
Here's a sample call of r.in.bin to import ETOPO2 DEM data (here full data set):
r.in.bin ETOPO2.dos.bin out=ETOPO2min r=5400 c=10800 n=90 s=-90 w=-180 e=180 bytes=2
r.colors ETOPO2min rules=terrain
π TOPEX/SRTM30 PLUS
Here's a sample call of r.in.bin to import SRTM30 PLUS data:
r.in.bin -sb input=e020n40.Bathymetry.srtm output=e020n40_topex \
bytes=2 north=40 south=-10 east=60 west=20 r=6000 c=4800
r.colors e020n40_topex rules=etopo2
β GPCP
Here's a sample call of r.in.bin to import GPCP 1DD v1.2 data:
YEAR="2000"
MONTH="01"
# number of days of this month
MDAYS=`date -d"${YEAR}-${MONTH}-01 + 1 month - 1 day" +%d`
r.in.bin in=gpcp_1dd_v1.2_p1d.${YEAR}${MONTH} out=gpcp_${YEAR}.${MONTH}. \
order=big bytes=4 -f header=1440 anull=-99999 \
n=90 s=-90 w=0 e=360 rows=180 cols=360 bands=$MDAYS
And here's a sample call of r.in.bin to import GPCP v2.2 data:
r.in.bin in=gpcp_v2.2_psg.1979 out=gpcp_1979. \
order=big bytes=4 -f header=576 anull=-99999 \
n=90 s=-90 w=0 e=360 rows=72 cols=144 bands=12
π SEE ALSO
r.import, r.out.bin, r.in.ascii, r.out.ascii, r.in.gdal, r.out.gdal, r.in.srtm
π AUTHORS
- Jacques Bouchard, France (
bouchard@onera.fr) - Bob Covill, Canada (
bcovill@tekmap.ns.ca) - Markus Metz
- Man page: Zsolt Felker (
felker@c160.pki.matav.hu)
π¦ SOURCE CODE
Available at: r.in.bin source code (history)
Accessed: Saturday Jan 17 05:40:47 2026
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
and that's a wrap bestie π this was r.in.bin(1) out of the GRASS 8.4.2 manual β go import something iconic, you got this πβ¨π¦
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms