.\" Man page generated from reStructuredText. . .TH "XYZ2GRD" "1gmt" "Jan 10, 2019" "5.4.5" "GMT" .SH NAME xyz2grd \- Convert data table to a grid file . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp \fBxyz2grd\fP [ \fItable\fP ] \fB\-G\fP\fIgrdfile\fP \fB\-I\fP\fIincrement\fP \fB\-R\fP\fIregion\fP [ \fB\-A\fP[\fBd\fP|\fBf\fP|\fBl\fP|\fBm\fP|\fBn\fP|\fBr\fP|\fBS\fP|\fBs\fP|\fBu\fP|\fBz\fP] ] [ \fB\-D\fP[\fB+x\fP\fIxname\fP][\fB+y\fP\fIyname\fP][\fB+z\fP\fIzname\fP][\fB+s\fP\fIscale\fP][\fB+o\fP\fIoffset\fP][\fB+n\fP\fIinvalid\fP][\fB+t\fP\fItitle\fP][\fB+r\fP\fIremark\fP] ] [ \fB\-J\fP\fIparameters\fP ] [ \fB\-S\fP[\fIzfile\fP] ] [ \fB\-V\fP[\fIlevel\fP] ] [ \fB\-Z\fP[\fIflags\fP] ] [ \fB\-bi\fPbinary ] [ \fB\-di\fPnodata ] [ \fB\-e\fPregexp ] [ \fB\-f\fPflags ] [ \fB\-h\fPheaders ] [ \fB\-i\fPflags ] [ \fB\-r\fP ] [ \fB\-:\fP[\fBi\fP|\fBo\fP] ] .sp \fBNote:\fP No space is allowed between the option flag and the associated arguments. .SH DESCRIPTION .sp \fBxyz2grd\fP reads one or more z or xyz tables and creates a binary grid file. \fBxyz2grd\fP will report if some of the nodes are not filled in with data. Such unconstrained nodes are set to a value specified by the user [Default is NaN]. Nodes with more than one value will be set to the mean value. As an option (using \fB\-Z\fP), a 1\-column z\-table may be read assuming all nodes are present (z\-tables can be in organized in a number of formats, see \fB\-Z\fP below.) Note: \fBxyz2grd\fP does not grid the data, it simply reformats existing data to a grid structure. For gridding, see \fBsurface\fP, \fBgreenspline\fP, \fBnearneighbor\fP, or \fBtriangulate\fP\&. .SH REQUIRED ARGUMENTS .INDENT 0.0 .TP \fB\-G\fP\fIgrdfile\fP \fIgrdfile\fP is the name of the binary output grid file. (See GRID FILE FORMAT below.) .UNINDENT .INDENT 0.0 .TP \fB\-I\fP\fIxinc\fP[\fIunit\fP][\fB+e\fP|\fBn\fP][/\fIyinc\fP[\fIunit\fP][\fB+e\fP|\fBn\fP]] \fIx_inc\fP [and optionally \fIy_inc\fP] is the grid spacing. Optionally, append a suffix modifier. \fBGeographical (degrees) coordinates\fP: Append \fBm\fP to indicate arc minutes or \fBs\fP to indicate arc seconds. If one of the units \fBe\fP, \fBf\fP, \fBk\fP, \fBM\fP, \fBn\fP or \fBu\fP is appended instead, the increment is assumed to be given in meter, foot, km, Mile, nautical mile or US survey foot, respectively, and will be converted to the equivalent degrees longitude at the middle latitude of the region (the conversion depends on PROJ_ELLIPSOID). If \fIy_inc\fP is given but set to 0 it will be reset equal to \fIx_inc\fP; otherwise it will be converted to degrees latitude. \fBAll coordinates\fP: If \fB+e\fP is appended then the corresponding max \fIx\fP (\fIeast\fP) or \fIy\fP (\fInorth\fP) may be slightly adjusted to fit exactly the given increment [by default the increment may be adjusted slightly to fit the given domain]. Finally, instead of giving an increment you may specify the \fInumber of nodes\fP desired by appending \fB+n\fP to the supplied integer argument; the increment is then recalculated from the number of nodes and the domain. The resulting increment value depends on whether you have selected a gridline\-registered or pixel\-registered grid; see App\-file\-formats for details. Note: if \fB\-R\fP\fIgrdfile\fP is used then the grid spacing has already been initialized; use \fB\-I\fP to override the values. .UNINDENT .INDENT 0.0 .TP \fB\-R\fP\fIxmin\fP/\fIxmax\fP/\fIymin\fP/\fIymax\fP[\fB+r\fP][\fB+u\fP\fIunit\fP] (more ...) Specify the region of interest. .UNINDENT .SH OPTIONAL ARGUMENTS .INDENT 0.0 .TP .B \fItable\fP One or more ASCII [or binary, see \fB\-bi\fP] files holding z or (x,y,z) values. The xyz triplets do not have to be sorted. One\-column z tables must be sorted and the \fB\-Z\fP must be set. .UNINDENT .INDENT 0.0 .TP \fB\-A\fP[\fBd\fP|\fBf\fP|\fBl\fP|\fBm\fP|\fBn\fP|\fBr\fP|\fBS\fP|\fBs\fP|\fBu\fP|\fBz\fP] By default we will calculate mean values if multiple entries fall on the same node. Use \fB\-A\fP to change this behavior, except it is ignored if \fB\-Z\fP is given. Append \fBf\fP or \fBs\fP to simply keep the first or last data point that was assigned to each node. Append \fBl\fP or \fBu\fP or \fBd\fP to find the lowest (minimum) or upper (maximum) value or the difference between the maximum and miminum value at each node, respectively. Append \fBm\fP or \fBr\fP or \fBS\fP to compute mean or RMS value or standard deviation at each node, respectively. Append \fBn\fP to simply count the number of data points that were assigned to each node (this only requires two input columns \fIx\fP and \fIy\fP as \fIz\fP is not consulted). Append \fBz\fP to sum multiple values that belong to the same node. .UNINDENT .INDENT 0.0 .TP \fB\-D\fP[\fB+x\fP\fIxname\fP][\fB+y\fP\fIyname\fP][\fB+z\fP\fIzname\fP][\fB+s\fP\fIscale\fP][\fB+o\fP\fIoffset\fP][\fB+n\fP\fIinvalid\fP][\fB+t\fP\fItitle\fP][\fB+r\fP\fIremark\fP] Give one or more combinations for values \fIxname\fP, \fIyname\fP, \fIzname\fP (give the names of those variables and in square bracket their units, e.g., "distance [km]"), \fIscale\fP (to multiply grid values after read [normally 1]), \fIoffset\fP (to add to grid after scaling [normally 0]), \fIinvalid\fP (a value to represent missing data [NaN]), \fItitle\fP (anything you like), and \fIremark\fP (anything you like). Items not listed will remain untouched. Give a blank name to completely reset a particular string. Use quotes to group texts with more than one word. Note that for geographic grids (\fB\-fg\fP) \fIxname\fP and \fIyname\fP are set automatically. .UNINDENT .INDENT 0.0 .TP \fB\-J\fP\fIparameters\fP (more ...) Select map projection. Use the \fB\-J\fP syntax to save the georeferencing info as CF\-1 compliant metadata in netCDF grids. This metadata will be recognized by GDAL. .UNINDENT .INDENT 0.0 .TP \fB\-S\fP[\fIzfile\fP] Swap the byte\-order of the input only. No grid file is produced. You must also supply the \fB\-Z\fP option. The output is written to \fIzfile\fP (or stdout if not supplied). .UNINDENT .INDENT 0.0 .TP \fB\-V\fP[\fIlevel\fP] (more ...) Select verbosity level [c]. .UNINDENT .INDENT 0.0 .TP \fB\-Z\fP[\fIflags\fP] Read a 1\-column ASCII [or binary] table. This assumes that all the nodes are present and sorted according to specified ordering convention contained in \fIflags\fP\&. If incoming data represents 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 is 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. Note: These two row/column indicators are only required for grids; for other tables they do not apply. For gridline registered grids: If data are periodic in x but the incoming data do not contain the (redundant) column at x = xmax, append \fBx\fP\&. For data periodic in y without redundant row at y = ymax, append \fBy\fP\&. Append \fBs\fP\fIn\fP to skip the first \fIn\fP number of bytes (probably a header). If the byte\-order or the words needs to be swapped, append \fBw\fP\&. Select one of several data types (all binary except \fBa\fP): .sp \fBA\fP ASCII representation of one or more floating point values per record .sp \fBa\fP ASCII representation of a single item per record .sp \fBc\fP int8_t, signed 1\-byte character .sp \fBu\fP uint8_t, unsigned 1\-byte character .sp \fBh\fP int16_t, signed 2\-byte integer .sp \fBH\fP uint16_t, unsigned 2\-byte integer .sp \fBi\fP int32_t, signed 4\-byte integer .sp \fBI\fP uint32_t, unsigned 4\-byte integer .sp \fBl\fP int64_t, long (8\-byte) integer .sp \fBL\fP uint64_t, unsigned long (8\-byte) integer .sp \fBf\fP 4\-byte floating point single precision .sp \fBd\fP 8\-byte floating point double precision .sp Default format is scanline orientation of ASCII numbers: \fB\-ZTLa\fP\&. Note that \fB\-Z\fP only applies to 1\-column input. The difference between \fBA\fP and \fBa\fP is that the latter can decode both \fIdate\fP\fBT\fP\fIclock\fP and \fIddd:mm:ss[.xx]\fP formats while the former is strictly for regular floating point values. .UNINDENT .INDENT 0.0 .TP \fB\-bi\fP[\fIncols\fP][\fBt\fP] (more ...) Select native binary input. [Default is 3 input columns]. This option only applies to xyz input files; see \fB\-Z\fP for z tables. .UNINDENT .INDENT 0.0 .TP \fB\-di\fP\fInodata\fP (more ...) Replace input columns that equal \fInodata\fP with NaN. Also sets nodes with no input xyz triplet to this value [Default is NaN]. .UNINDENT .INDENT 0.0 .TP \fB\-e\fP[\fB~\fP]\fI"pattern"\fP \fB|\fP \fB\-e\fP[\fB~\fP]/\fIregexp\fP/[\fBi\fP] (more ...) Only accept data records that match the given pattern. .UNINDENT .INDENT 0.0 .TP \fB\-f\fP[\fBi\fP|\fBo\fP]\fIcolinfo\fP (more ...) Specify data types of input and/or output columns. .UNINDENT .INDENT 0.0 .TP \fB\-h\fP[\fBi\fP|\fBo\fP][\fIn\fP][\fB+c\fP][\fB+d\fP][\fB+r\fP\fIremark\fP][\fB+r\fP\fItitle\fP] (more ...) Skip or produce header record(s). Not used with binary data. .UNINDENT .INDENT 0.0 .TP \fB\-i\fP\fIcols\fP[\fB+l\fP][\fB+s\fP\fIscale\fP][\fB+o\fP\fIoffset\fP][,\fI\&...\fP] (more ...) Select input columns and transformations (0 is first column). .UNINDENT .INDENT 0.0 .TP \fB\-r\fP (more ...) Set pixel node registration [gridline]. .UNINDENT .INDENT 0.0 .TP \fB\-:\fP[\fBi\fP|\fBo\fP] (more ...) Swap 1st and 2nd column on input and/or output. .UNINDENT .INDENT 0.0 .TP \fB\-^\fP or just \fB\-\fP Print a short message about the syntax of the command, then exits (NOTE: on Windows just use \fB\-\fP). .TP \fB\-+\fP or just \fB+\fP Print an extensive usage (help) message, including the explanation of any module\-specific option (but not the GMT common options), then exits. .TP \fB\-?\fP or no arguments Print a complete usage (help) message, including the explanation of all options, then exits. .UNINDENT .SH GRID VALUES PRECISION .sp Regardless of the precision of the input data, GMT programs that create grid files will internally hold the grids in 4\-byte floating point arrays. This is done to conserve memory and furthermore most if not all real data can be stored using 4\-byte floating point values. Data with higher precision (i.e., double precision values) will lose that precision once GMT operates on the grid or writes out new grids. To limit loss of precision when processing data you should always consider normalizing the data prior to processing. .SH GRID FILE FORMATS .sp By default GMT writes out grid as single precision floats in a COARDS\-complaint netCDF file format. However, GMT is able to produce grid files in many other commonly used grid file formats and also facilitates so called "packing" of grids, writing out floating point data as 1\- or 2\-byte integers. To specify the precision, scale and offset, the user should add the suffix =\fIID\fP[\fB+s\fP\fIscale\fP][\fB+o\fP\fIoffset\fP][\fB+n\fP\fIinvalid\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 \fIinvalid\fP is the value used to indicate missing data. See grdconvert and Section grid\-file\-format of the GMT Technical Reference and Cookbook for more information. .sp When writing a netCDF file, the grid is stored by default with the variable name "z". To specify another variable name \fIvarname\fP, append \fB?\fP\fIvarname\fP to the file name. 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. .SH GEOGRAPHICAL AND TIME COORDINATES .sp When the output grid type is netCDF, the coordinates will be labeled "longitude", "latitude", or "time" based on the attributes of the input data or grid (if any) or on the \fB\-f\fP or \fB\-R\fP options. For example, both \fB\-f0x\fP \fB\-f1t\fP and \fB\-R\fP90w/90e/0t/3t will result in a longitude/time grid. When the x, y, or z coordinate is time, it will be stored in the grid as relative time since epoch as specified by TIME_UNIT and TIME_EPOCH in the gmt.conf file or on the command line. In addition, the \fBunit\fP attribute of the time variable will indicate both this unit and epoch. .SH SWAPPING LIMITATIONS .sp All data types can be read, even 64\-bit integers, but internally grids are stored using floats. Hence, integer values exceeding the float type\(aqs 23\-bit mantissa may not be represented exactly. When \fB\-S\fP is used no grids are implied and we read data into an intermediate double container. This means all but 64\-bit integers can be represented using the double type\(aqs 53\-bit mantissa. .SH EXAMPLES .sp To create a grid file from the ASCII data in hawaii_grv.xyz, use .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B gmt xyz2grd hawaii_grv.xyz \-D+xdegree+ydegree+zGal+t"Hawaiian Gravity"+r"GRS\-80 Ellipsoid used" \-Ghawaii_grv_new.nc \-R198/208/18/25 \-I5m \-V .UNINDENT .UNINDENT .UNINDENT .sp To create a grid file from the raw binary (3\-column, single\-precision scanline\-oriented data raw.b, use .INDENT 0.0 .INDENT 3.5 gmt xyz2grd raw.b \-D+xm+ym+zm \-Graw.nc \-R0/100/0/100 \-I1 \-V \-Z \-bi3f .UNINDENT .UNINDENT .sp To make a grid file from the raw binary USGS DEM (short integer scanline\-oriented data topo30.b on the NGDC global relief Data CD\-ROM, with values of \-9999 indicate missing data, one must on some machine reverse the byte\-order. On such machines (like Sun), use .INDENT 0.0 .INDENT 3.5 gmt xyz2grd topo30.b \-D+xm+ym+zm \-Gustopo.nc \-R234/294/24/50 \-I30s \-di\-9999 \-ZTLhw .UNINDENT .UNINDENT .sp Say you have received a binary file with 4\-byte floating points that were written on a machine of different byte\-order than yours. You can swap the byte\-order with .INDENT 0.0 .INDENT 3.5 gmt xyz2grd floats.bin \-Snew_floats.bin \-V \-Zf .UNINDENT .UNINDENT .SH SEE ALSO .sp gmt, grd2xyz, grdedit, grdconvert, greenspline, nearneighbor, surface, triangulate .SH COPYRIGHT 2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe .\" Generated by docutils manpage writer. .