r.in.bin(1grass)

πŸ’– r.in.bin β€” the manual, but make it bestie ✨

okay so this is the GRASS User's Manual page for r.in.bin(1grass), and babes, it's a banger. Importing binary raster files? Into a GRASS raster map layer? We're literally doing file-format manifesting here. Let's go πŸ¦‹


✨ NAME ✨

r.in.bin β€” Import a binary raster file into a GRASS raster map layer.

🏷️ KEYWORDS 🏷️

raster, import


🌸 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 (default vibe is integer, jsyk)
  • -d β€” import it as double-precision floating-point data (again, default is integer)
  • -s β€” signed data, aka two's complement, we love a negative number πŸ’…
  • -b β€” byte swap the data while importing, for when endianness is being messy
  • -h β€” grab the region info from a GMT style header, iconic
  • --overwrite β€” allow output files to overwrite existing files (no take-backs, enabled by u)
  • --help β€” print usage summary, when you need a lil refresher
  • --verbose β€” verbose module output, she's talking a LOT
  • --quiet β€” quiet module output, she's giving nothing 🫢
  • --ui β€” force launching GUI dialog, for the visual girlies

πŸŽ€ Parameters πŸŽ€

  • input=name [required] β€” name of the binary raster file to be imported
  • output=name [required] β€” output name, or a prefix if you're importing several bands (multitasking queen)
  • title=phrase β€” title for the resultant raster map
  • bytes=integer β€” number of bytes per cell. Options: 1, 2, 4, 8
  • header=integer β€” header size in bytes. Default: 0
  • bands=integer β€” number of bands in the input file. Bands must be in band-sequential order, okay? order matters!! Default: 1
  • order=string β€” output byte order. Options: big, little, native, swap. Default: native
  • north=float β€” northern limit of geographic region (outer edge)
  • south=float β€” southern limit of geographic region (outer edge)
  • east=float β€” eastern limit of geographic region (outer edge)
  • west=float β€” western limit of geographic region (outer edge)
  • rows=integer β€” number of rows
  • cols=integer β€” number of columns
  • anull=float β€” set value to NULL
  • flip=string[,string,...] β€” flip input horizontal and/or vertical. Options: h, v
    • h: 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 variety of binary raster data formats. she's versatile, she's flexible, she contains multitudes.

The -s flag is what you reach for when you're importing two's-complement signed data.

The -h flag is the move for reading region info straight out of a Generic Mapping Tools (GMT) type binary header. It plays nice with GMT binary grid types 1 and 2. compatible queen πŸ‘‘

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 follows. And listen β€” if your input is a GMT binary array (that's the -h flag situation), then all six dimension fields (north, south, east, west, rows and cols) get pulled from the GMT header instead. If you enter the bytes field wrong, it's gonna throw an error at you and gently suggest a closer bytes value. it's not mad, it's just helping πŸ™ˆ

r.in.bin can import sooo many binary arrays, including: ETOPO30, ETOPO-5, ETOPO-2, Globe DEM, BIL, AVHRR and GMT binary arrays (ID 1 & 2). the range? unmatched. πŸ”₯


πŸ“ NOTES πŸ“

If you don't hand over the optional parameters, r.in.bin will just try to calculate them herself. main character problem-solving energy. For example, if you skip rows and columns, she automatically computes them by subtracting south from north and west from east. but bestie β€” that only gives correct results when the raster resolution equals 1. no cap.

Also, if you don't give her north, south, east, and west, she assigns them from the rows and columns parameters. In that AVHRR example down below, the raster would get assigned north=128, south=0, east=128, west=0. cute, right?

The geographic coordinates north, south, east, and west describe the outer edges of the geographic region. IMPORTANT!!! 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. let that sink in 🫢

  • Eastern limit of geographic region (in projected coordinates must be east of the west parameter value, but in geographical coordinates will wrap around the globe; user errors can be detected by comparing the ewres and nsres values of the imported map layer carefully).
  • Western limit of geographic region (in projected coordinates must be west of the east parameter value, but in geographical coordinates will wrap around the globe; user errors can be detected by comparing the ewres and nsres values of the imported map layer carefully).

πŸ€” Notes on (non)signed data πŸ€”

If you use the -s flag, the highest bit is the sign bit. If that bit is 1, the data is negative, and the data interval is half of the unsigned (not exactly). like... approximately half, don't come for her.

⚠️ Heads up: this flag is only used if bytes= 1. If bytes is greater than 1, the flag is ignored. periodt. πŸ’€

🌈 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

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

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

Sample call of r.in.bin to import ETOPO2 DEM data (here, the 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

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

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

go read those too, they're all part of the friend group 🫢


πŸ‘‘ 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)

Latest change: Thursday May 08 20:58:05 2025 in commit: 4144ba81fa125e1549fc52e1cf5feb4fa004be8b

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index


okay that's the whole page bestie, you made it to the end πŸ’– this was GRASS 8.5.0, Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual β€” and r.in.bin(1grass) says goodnight. now go import something gorgeous. slay βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from