1GRD2XYZ(1)                            GMT                           GRD2XYZ(1)
2
3
4

NAME

6       grd2xyz - Convert grid file to data table
7

SYNOPSIS

9       grd2xyz  grid [  -C[f|i] ] [  -Rregion ] [  -V[level] ] [  -W[a|weight]
10       ] [  -Z[flags] ] [ -bobinary ] [ -dnodata ] [ -fflags ] [  -ho[n]  ]  [
11       -oflags ] [ -sflags ]
12
13       Note:  No  space  is allowed between the option flag and the associated
14       arguments.
15

DESCRIPTION

17       grd2xyz reads one  or  more  binary  2-D  grid  files  and  writes  out
18       xyz-triplets in ASCII [or binary] format to standard output. Modify the
19       precision of the ASCII output format by  editing  the  FORMAT_FLOAT_OUT
20       parameter in your gmt.conf file or use --D_FORMAT=format on the command
21       line, or choose binary output using single or double precision storage.
22       As an option you may output z-values without the (x,y) coordinates; see
23       -Z below.
24

REQUIRED ARGUMENTS

26       grid   Names of 2-D binary grid files to be converted. (See  GRID  FILE
27              FORMATS below.)
28

OPTIONAL ARGUMENTS

30       -C[f|i]
31              Replace  the x- and y-coordinates on output with the correspond‐
32              ing column and row numbers. These start at 0 (C-style counting);
33              append  f to start at 1 (Fortran-style counting). Alternatively,
34              append i to write just the two columns index and z, where  index
35              is the 1-D indexing that GMT uses when referring to grid nodes.
36
37       -Rxmin/xmax/ymin/ymax[+r][+uunit] (more ...)
38              Specify  the region of interest. Using the -R option will select
39              a subsection of the grid. If this subsection exceeds the  bound‐
40              aries of the grid, only the common region will be output.
41
42       -V[level] (more ...)
43              Select verbosity level [c].
44
45       -W[a|weight]
46              Write  out  x,y,z,w, where w is the supplied weight (or 1 if not
47              supplied) [Default writes x,y,z only].  Choose  -Wa  to  compute
48              weights equal to the area each node represents.
49
50       -Z[flags]
51              Write  a  1-column ASCII [or binary] table. Output will be orga‐
52              nized according to the specified ordering  convention  contained
53              in  flags.   If data should be written by rows, make flags start
54              with T (op) if first row is y = ymax or B (ottom) if  first  row
55              is  y = ymin. Then, append L or R to indicate that first element
56              should start at left or right end of row.  Likewise  for  column
57              formats:  start  with  L or R to position first column, and then
58              append T or B to position first element in a row.  For  gridline
59              registered  grids: If grid is periodic in x but the written data
60              should not contain the (redundant) column at x = xmax, append x.
61              For  grid  periodic  in y, skip writing the redundant row at y =
62              ymax by appending y. If the  byte-order  needs  to  be  swapped,
63              append  w.  Select  one of several data types (all binary except
64              a):
65
66              · a ASCII representation of a single item per record
67
68              · c int8_t, signed 1-byte character
69
70              · u uint8_t, unsigned 1-byte character
71
72              · h int16_t, short 2-byte integer
73
74              · H uint16_t, unsigned short 2-byte integer
75
76              · i int32_t, 4-byte integer
77
78              · I uint32_t, unsigned 4-byte integer
79
80              · l int64_t, long (8-byte) integer
81
82              · L uint64_t, unsigned long (8-byte) integer
83
84              · f 4-byte floating point single precision
85
86              · d 8-byte floating point double precision
87
88              Default format is scanline orientation of ASCII numbers:  -ZTLa.
89              Note that -Z only applies to 1-column output.
90
91       -bo[ncols][type] (more ...)
92              Select  native  binary  output. [Default is 3]. This option only
93              applies to xyz output; see -Z for z table output.
94
95       -d[i|o]nodata (more ...)
96              Replace input columns that equal nodata  with  NaN  and  do  the
97              reverse on output.
98
99       -f[i|o]colinfo (more ...)
100              Specify data types of input and/or output columns. See also TIME
101              COORDINATES below. -h Output 1 header record based  on  informa‐
102              tion  in the first grid file header. Ignored if binary output is
103              selected. [Default is no header].
104
105       -ocols[,...] (more ...)
106              Select output columns (0 is first column).
107
108       -s[cols][a|r] (more ...)
109              Set handling of NaN records.
110
111       -^ or just -
112              Print a short message about the  syntax  of  the  command,  then
113              exits (NOTE: on Windows just use -).
114
115       -+ or just +
116              Print  an extensive usage (help) message, including the explana‐
117              tion of any module-specific  option  (but  not  the  GMT  common
118              options), then exits.
119
120       -? or no arguments
121              Print a complete usage (help) message, including the explanation
122              of all options, then exits.
123

ASCII FORMAT PRECISION

125       The ASCII output formats of numerical data are controlled by parameters
126       in  your  gmt.conf file. Longitude and latitude are formatted according
127       to  FORMAT_GEO_OUT,  absolute  time  is  under  the  control  of   FOR‐
128       MAT_DATE_OUT  and FORMAT_CLOCK_OUT, whereas general floating point val‐
129       ues are formatted according to FORMAT_FLOAT_OUT. Be aware that the for‐
130       mat  in effect can lead to loss of precision in ASCII output, which can
131       lead to various problems downstream. If you  find  the  output  is  not
132       written with enough precision, consider switching to binary output (-bo
133       if available) or specify more decimals using the FORMAT_FLOAT_OUT  set‐
134       ting.
135

GRID FILE FORMATS

137       By  default  GMT  writes  out  grid  as  single  precision  floats in a
138       COARDS-complaint netCDF file format. However, GMT is  able  to  produce
139       grid  files  in  many  other  commonly  used grid file formats and also
140       facilitates so called "packing" of grids, writing  out  floating  point
141       data as 1- or 2-byte integers. (more ...)
142

TIME COORDINATES

144       Time coordinates in netCDF grids, be it the x, y, or z coordinate, will
145       be recognized as such. The  variable's  unit  attribute  is  parsed  to
146       determine the unit and epoch of the time coordinate in the grid. Values
147       are then converted to the internal time system specified  by  TIME_UNIT
148       and TIME_EPOCH in the gmt.conf file or on the command line. The default
149       output is relative time in that time  system,  or  absolute  time  when
150       using the option -f0T, -f1T, or -f2T for x, y, or z coordinate, respec‐
151       tively.
152

EXAMPLES

154       To edit individual values in the 5' by 5' hawaii_grv.nc file, dump  the
155       .nc to ASCII:
156
157              gmt grd2xyz hawaii_grv.nc > hawaii_grv.xyz
158
159       To  write a single precision binary file without the x,y positions from
160       the file raw_data.nc file, using scanline orientation, run
161
162              gmt grd2xyz raw_data.nc -ZTLf > hawaii_grv.b
163

SEE ALSO

165       gmt.conf, gmt, grdedit, grdconvert, xyz2grd
166
168       2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
169
170
171
172
1735.4.5                            Feb 24, 2019                       GRD2XYZ(1)
Impressum