File: grd2xyz.1

package info (click to toggle)
gmt 4.5.12-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 71,528 kB
  • ctags: 12,619
  • sloc: ansic: 138,042; sh: 4,992; csh: 1,085; makefile: 1,034; asm: 38
file content (158 lines) | stat: -rw-r--r-- 8,938 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
.TH GRD2XYZ 1 "Feb 27 2014" "GMT 4.5.13 (SVN)" "Generic Mapping Tools"
.SH NAME
grd2xyz \- Converting grid file(s) to ASCII or binary data
.SH SYNOPSIS
\fBgrd2xyz\fP \fIgrdfiles\fP [ \fB\-E\fP[\fBf\fP][\fInodata\fP] ] [ \fB\-H\fP[\fBi\fP][\fInrec\fP] ] [ \fB\-N\fP\fInodata\fP ] [ \fB\-R\fP\fIwest\fP/\fIeast\fP/\fIsouth\fP/\fInorth\fP[\fBr\fP] ] 
[ \fB\-S\fP[\fBr\fP] ] [ \fB\-V\fP ] [ \fB\-W\fP[\fIweight\fP] ] [ \fB\-Z\fP[\fIflags\fP] ] 
[ \fB\-bo\fP[\fBs\fP|\fBS\fP|\fBd\fP|\fBD\fP[\fIncol\fP]|\fBc\fP[\fIvar1\fP\fB/\fP\fI...\fP]] ] [ \fB\-f\fP\fIcolinfo\fP ]
.SH DESCRIPTION
\fBgrd2xyz\fP reads one or more binary 2-D grid files and writes out xyz-triplets in
ASCII [or binary] format to standard output.  Modify the precision of the ASCII
output format by editing the \fBD_FORMAT\fP parameter in your \.gmtdefaults4 file or
use \fB\-\-D_FORMAT\fP=\fIvalue\fP on the command line, 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 \fB\-E\fP or \fB\-Z\fP below.
.TP
\fIgrdfiles\fP
Names of 2-D binary grid files to be converted.
(See GRID FILE FORMATS below.)
.SH OPTIONS
.TP
\fB\-E\fP
Output an ESRI ArcInfo ASCII interchange grid format file.  Append \fBf\fP for float output [Default is integer].
Append \fInodata\fP which will be used wherever
the grid value equals NaN [-9999].
.TP
\fB\-H\fP
Output 1 header record based on information in the first grid file header.
Ignored if binary output is selected.  [Default is no header].
.TP
\fB\-N\fP
Output this z-value where the latter equals NaN [Default writes NaN].
.TP
\fB\-R\fP
\fIxmin\fP, \fIxmax\fP, \fIymin\fP, and \fIymax\fP specify the Region of interest.  For geographic
regions, these limits correspond to \fIwest, east, south,\fP and \fInorth\fP and you may specify them
in decimal degrees or in [+-]dd:mm[:ss.xxx][W|E|S|N] format.  Append \fBr\fP if lower left and upper right
map coordinates are given instead of w/e/s/n.  The two shorthands \fB\-Rg\fP and \fB\-Rd\fP stand for global domain
(0/360 and -180/+180 in longitude respectively, with -90/+90 in latitude).  Alternatively, specify the name
of an existing grid file and the \fB\-R\fP settings (and grid spacing, if applicable) are copied from the grid.
For calendar time coordinates you may either give (a) relative
time (relative to the selected \fBTIME_EPOCH\fP and in the selected \fBTIME_UNIT\fP; append \fBt\fP to
\fB\-JX\fP|\fBx\fP), or (b) absolute time of the form [\fIdate\fP]\fBT\fP[\fIclock\fP]
(append \fBT\fP to \fB\-JX\fP|\fBx\fP).  At least one of \fIdate\fP and \fIclock\fP
must be present; the \fBT\fP is always required.  The \fIdate\fP string must be of the form [-]yyyy[-mm[-dd]]
(Gregorian calendar) or yyyy[-Www[-d]] (ISO week calendar), while the \fIclock\fP string must be of
the form hh:mm:ss[.xxx].  The use of delimiters and their type and positions must be exactly as indicated
(however, input, output and plot formats are customizable; see \fBgmtdefaults\fP). 
Using the \fB\-R\fP option will select a subsection of the grid. If this subsection exceeds the
boundaries of the grid, only the common region will be output.
.TP
\fB\-S\fP
Suppress output for nodes whose z-value equals NaN [Default outputs all nodes].
Append \fBr\fP to reverse the suppression, i.e., only output the nodes whose
z-value equals NaN.
.TP
\fB\-V\fP
Selects verbose mode, which will send progress reports to stderr [Default runs "silently"].
.TP
\fB\-W\fP
Write out x,y,z,w, where w is the supplied \fIweight\fP (or 1 if not supplied) [Default writes x,y,z only].
.TP
\fB\-Z\fP
Write a 1-column ASCII [or binary] table.  Output will be organized according to the specified ordering convention contained in \fIflags\fP.
If data should be written by rows, make \fIflags\fP start with \fBT\fP(op) if first row is y = ymax
or \fBB\fP(ottom) if first row is y = ymin.  Then, append \fBL\fP or \fBR\fP to indicate that first element should start at left
or right end of row.  Likewise for column formats: start with \fBL\fP or \fBR\fP to position first column,
and then append \fBT\fP or \fBB\fP 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 \fBx\fP.  For grid periodic in y,
skip writing the redundant row at y = ymax by appending \fBy\fP.  If the byte-order needs to be swapped, append \fBw\fP.  Select
one of several data types (all binary except \fBa\fP):
.br
.sp
.RS
\fBa\fP  ASCII representation
.br
\fBc\fP  signed 1-byte character
.br
\fBu\fP  unsigned 1-byte character
.br
\fBh\fP  short 2-byte integer
.br
\fBi\fP  4-byte integer
.br
\fBl\fP  long (4- or 8-byte) integer [architecture-dependent!]
.br
\fBf\fP  4-byte floating point single precision
.br
\fBd\fP  8-byte floating point double precision
.br
.sp
Default format is scanline orientation of ASCII numbers: \fB\-ZTLa\fP.
Note that \fB\-Z\fP only applies to 1-column output.
.RE
.TP
\fB\-bo\fP
Selects binary output.
Append \fBs\fP for single precision [Default is \fBd\fP (double)].
Uppercase \fBS\fP or \fBD\fP will force byte-swapping.
Optionally, append \fIncol\fP, the number of desired columns in your binary output file.
[Default is 3].
This option only applies to xyz output; see \fB\-Z\fP for z table output.
.TP
\fB\-f\fP
Special formatting of input and/or output columns (time or geographical data).
Specify \fBi\fP or \fBo\fP to make this apply only to input or output [Default applies to both].
Give one or more columns (or column ranges) separated by commas.
Append \fBT\fP (absolute calendar time), \fBt\fP (relative time in chosen \fBTIME_UNIT\fP since \fBTIME_EPOCH\fP),
\fBx\fP (longitude), \fBy\fP (latitude), or \fBf\fP (floating point) to each column
or column range item.  Shorthand \fB\-f\fP[\fBi\fP|\fBo\fP]\fBg\fP means \fB\-f\fP[\fBi\fP|\fBo\fP]0\fBx\fP,1\fBy\fP
(geographic coordinates).
See also \fBTIME COORDINATES\fP below.
.SH ASCII FORMAT PRECISION
The ASCII output formats of numerical data are controlled by parameters in
your \.gmtdefaults4 file.  Longitude and latitude are formatted according to
\fBOUTPUT_DEGREE_FORMAT\fP, whereas other values are formatted according
to \fBD_FORMAT\fP.  Be aware that the format in effect can lead to loss of
precision in the output, which can lead to various problems downstream.  If
you find the output is not written with enough precision, consider switching
to binary output (\fB\-bo\fP if available) or specify more decimals using
the \fBD_FORMAT\fP setting.
.SH GRID FILE FORMATS
\fBGMT\fP is able to recognize many of the commonly used grid file formats, as well as the precision, scale and offset of the values
contained in the grid file. When \fBGMT\fP needs a little help with that, you can add the suffix \fB=\fP\fIid\fP[\fB/\fP\fIscale\fP\fB/\fP\fIoffset\fP[\fB/\fP\fInan\fP]],
where \fIid\fP is a two-letter identifier of the grid type and precision, and \fIscale\fP and \fIoffset\fP are optional scale factor
and offset to be applied to all grid values, and \fInan\fP is the value used to indicate missing data.
See \fBgrdreformat\fP(1) and Section 4.17 of the GMT Technical Reference and Cookbook for more information.
.P
When reading a netCDF file that contains multiple grids, \fBGMT\fP will read, by default, the first 2-dimensional grid that can find in that
file. To coax \fBGMT\fP into reading another multi-dimensional variable in the grid file, append \fB?\fP\fIvarname\fP to the file name, where
\fIvarname\fP is the name of the variable. Note that you may need to escape the special meaning of \fB?\fP in your shell program
by putting a backslash in front of it, or by placing the filename and suffix between quotes or double quotes.
See \fBgrdreformat\fP(1) and Section 4.18 of the GMT Technical Reference and Cookbook for more information,
particularly on how to read splices of 3-, 4-, or 5-dimensional grids.
.SH TIME COORDINATES
Time coordinates in netCDF grids, be it the x, y, or z coordinate, will be recognized as such.
The variable's \fBunit\fP attribute is parsed to determine the unit and epoch of the time coordinate in the grid.
Values are then converted to the internal time system specified by \fBTIME_UNIT\fP and \fBTIME_EPOCH\fP in the \.gmtdefaults
file or on the command line.
The default output is relative time in that time system, or absolute time when using the option \fB\-f0T\fP, \fB\-f1T\fP, or
\fB\-f2T\fP for x, y, or z coordinate, respectively.
.SH EXAMPLES
To edit individual values in the 5' by 5' hawaii_grv.grd file, dump the .grd
to ASCII:
.br
.sp
\fBgrd2xyz\fP hawaii_grv.grd > hawaii_grv.xyz
.br
.sp
To write a single precision binary file without the x,y positions from the file raw_data.grd file, using scanline orientation, run
.br
.sp
\fBgrd2xyz\fP raw_data.grd \fB\-ZTLf\fP > hawaii_grv.b
.SH "SEE ALSO"
.IR gmtdefaults (1),
.IR GMT (1),
.IR grdedit (1),
.IR xyz2grd (1)