r.out.ascii
Converts a raster map layer into a GRASS ASCII text file.
r.out.ascii [-hsmi] input=name [output=name] [precision=integer] [width=integer] [null_value=string] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
r.out.ascii input=name
grass.script.run_command("r.out.ascii", input, output=None, precision=None, width=None, null_value="*", flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("r.out.ascii", input="name")
Parameters
input=name [required]
Name of input raster map
output=name
Name for output ASCII grid map (use out=- for stdout)
precision=integer
Number of significant digits (floating point only)
width=integer
Number of values printed before wrapping a line (only SURFER or MODFLOW format)
null_value=string
String to represent null cell (GRASS grid only)
Default: *
-h
Suppress printing of header information
-s
Write SURFER (Golden Software) ASCII grid
-m
Write MODFLOW (USGS) ASCII array
-i
Force output of integer values
--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 input raster map
Used as: input, raster, name
output : str, optional
Name for output ASCII grid map (use out=- for stdout)
Used as: output, file, name
precision : int, optional
Number of significant digits (floating point only)
width : int, optional
Number of values printed before wrapping a line (only SURFER or MODFLOW format)
null_value : str, optional
String to represent null cell (GRASS grid only)
Used as: string
Default: *
flags : str, optional
Allowed values: h, s, m, i
h
Suppress printing of header information
s
Write SURFER (Golden Software) ASCII grid
m
Write MODFLOW (USGS) ASCII array
i
Force output of integer values
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
r.out.ascii converts a user-specified raster map layer (input=name) into an ASCII grid in a text file (output=name) suitable for export to other computer systems.
The GRASS program r.in.ascii can be used to perform the reverse function, converting an ASCII file in suitable format to GRASS raster map format.
To write a SURFER .grd ASCII GRID file (with reverted row order and different header) use the -s flag:
r.out.ascii -s input=inname output=outname.grd [dp=value]
NULL data are coded to "1.70141e+038" for SURFER ASCII GRID files (ignoring the null= parameter).
NOTES
The output from r.out.ascii may be placed into a file by using the UNIX redirection mechanism; e.g.:
r.out.ascii input=soils output=- > out.file
The output file out.file can then be printed or copied onto a CDROM or floppy disk for export purposes.
To export the raster values as x,y,z values of cell centers (one per line) use the r.out.xyz module.
SEE ALSO
r.in.ascii, r.in.gdal, r.out.bin, r.out.gdal, r.out.xyz
AUTHORS
Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
Surfer support by Markus Neteler
SOURCE CODE
Available at: r.out.ascii source code
(history)
Latest change: Thursday Apr 03 12:13:14 2025 in commit 81ce7f0