NAME
grd2xyz - Converting grdfile(s) to ASCII or binary data
SYNOPSIS
grd2xyz grdfile(s) [ -H[nrec] ] [ -L ] [ -Rwest/east/south/north[r] [
-S[r ] [ -V ] [ -W[weight] ] [ -Z[flags] ] [ -bo[s][n] ] [ -f[i|o]col-
info ]
DESCRIPTION
grd2xyz reads one or more binary 2-D grdfile and writes out xyz-
triplets in ASCII [or binary] format to standard output. Modify the
precision of the ASCII output format by editing the D_FORMAT parameter
in your .gmtdefaults4 file, or choose binary output using single or
double precision storage. As an option you may output z-values without
the (x,y) in a number of formats, see -Z below.
grdfile
Names of 2-D binary grd files to be converted.
OPTIONS
-H Output 1 header record based on information in the first grdfile
header. Ignored if binary output is selected. [Default is no
header].
-L Indicates that the x values are longitudes (necessary for -: to
work).
-R xmin, xmax, ymin, and ymax specify the Region of interest. For
geographic regions, these limits correspond to west, east,
south, and north and you may specify them in decimal degrees or
in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left
and upper right map coordinates are given instead of wesn. The
two shorthands -Rg -Rd stand for global domain (0/360 or
-180/+180 in longitude respectively, with -90/+90 in latitude).
For calendar time coordinates you may either give relative time
(relative to the selected TIME_EPOCH and in the selected
TIME_UNIT; append t to -JX|x), or absolute time of the form
[date]T[clock] (append T to -JX|x). At least one of date and
clock must be present; the T is always required. The date string
must be of the form [-]yyyy[-mm[-dd]] (Gregorian calendar) or
yyyy[-Www[-d]] (ISO week calendar), while the clock string must
be of the form hh:mm:ss[.xxx]. The use of delimiters and their
type and positions must be as indicated (however, input/output
and plotting formats are flexible).
-S Suppress output for nodes whose z-value equals NaN [Default out-
puts all nodes]. Append r to reverse the suppression, i.e.,
only output the nodes whose z-value equals NaN.
-V Selects verbose mode, which will send progress reports to stderr
[Default runs "silently"].
-W Write out x,y,z,w, where w is the supplied weight (or 1 if not
supplied) [Default writes x,y,z only].
-Z Write a 1-column ASCII [or binary] table. Output will be orga-
nized according to the specified ordering convention contained
in flags. If data should be written by rows, make flags start
with T(op) if first row is y = ymax or B(ottom) if first row is
y = ymin. Then, append L or R to indicate that first element
should start at left or right end of row. Likewise for column
formats: start with L or R to position first column, and then
append T or B to position first element in a row. For gridline
registered grids: If grid is periodic in x but the outcoming
data should not contain the (redundant) column at x = xmax,
append x. For grid periodic in y, skip writing the redundant row
at y = ymax by appending y. If the byte-order needs to be
swapped, append w. Select one of several data types (all binary
except a):
a ASCII representation
c signed 1-byte character
u unsigned 1-byte character
h short 2-byte integer
i 4-byte integer
l long (4- or 8-byte) integer
f 4-byte floating point single precision
d 8-byte floating point double precision
Default format is scanline orientation of ASCII numbers: -ZTLa.
Note that -Z only applies to 1-column output.
-bo Selects binary output. Append s for single precision [Default is
double]. Append n for the number of columns in the binary
file(s).
This option only applies to xyz output; see -Z for z table out-
put.
-f Special formatting of input and output columns (time or geo-
graphical data) Specify i(nput) or o(utput) [Default is both
input and output]. Give one or more columns (or column ranges)
separated by commas. Append T (Absolute calendar time), t (time
relative to chosen TIME_EPOCH), x (longitude), y (latitude), g
(geographic coordinate), or f (floating point) to each column or
column range item.
EXAMPLES
To edit individual values in the 5’ by 5’ hawaii_grv.grd file, dump the
.grd to ASCII:
grd2xyz hawaii_grv.grd > hawaii_grv.xyz
To write a single precision binary file without the x,y positions from
the file raw_data.grd file, using scanline orientation, run
grd2xyz raw_data.grd -ZTLf > hawaii_grv.b
SEE ALSO
gmtdefaults(l), gmt(l), grdedit(l), xyz2grd(l)
GMT4.0 1 Oct 2004 GRD2XYZ(l)
Man(1) output converted with
man2html