Rechercher une page de manuel

Chercher une autre page de manuel:


Langue: en

Version: 333900 (ubuntu - 24/10/10)

Section: 1 (Commandes utilisateur)


xyz2grd - Converting an ASCII or binary table to grid file format


xyz2grd xyzfile -Ggrdfile -Ixinc[unit][=|+][/yinc[unit][=|+]] -Rwest/east/south/north[r] [ -A[n|z|u|l] ] [ -Dxname/yname/zname/scale/offset/title/remark ] [ -E[nodata] ] [ -F ] [ -H[i][nrec] ] [ -Nnodata ] [ -S[zfile] ] [ -V ] [ -Z[flags] ] [ -:[i|o] ] [ -bi[s|S|d|D[ncol]|c[var1/...]] ] [ -fcolinfo ]


xyz2grd reads a z or xyz table and creates a binary grid file. xyz2grd 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 average value. As an option (using -Z), 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 -Z below.)
ASCII [or binary] file holding z or (x,y,z) values. xyz triplets do not have to be sorted (for binary triplets, see -b). 1-column z tables must be sorted and the -Z must be set).
grdfile is the name of the binary output grid file. (See GRID FILE FORMAT below.)
x_inc [and optionally y_inc] is the grid spacing. Optionally, append a suffix modifier. Geographical (degrees) coordinates: Append m to indicate arc minutes or c to indicate arc seconds. If one of the units e, k, i, or n is appended instead, the increment is assumed to be given in meter, km, miles, or nautical miles, respectively, and will be converted to the equivalent degrees longitude at the middle latitude of the region (the conversion depends on ELLIPSOID). If /y_inc is given but set to 0 it will be reset equal to x_inc; otherwise it will be converted to degrees latitude. All coordinates: If = is appended then the corresponding max x (east) or y (north) 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 number of nodes desired by appending + 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 Appendix B for details. Note: if -Rgrdfile is used then grid spacing has already been initialized; use -I to override the values.
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[][W|E|S|N] format. Append r if lower left and upper right map coordinates are given instead of w/e/s/n. The two shorthands -Rg and -Rd 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 -R 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 TIME_EPOCH and in the selected TIME_UNIT; append t to -JX|x), or (b) 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 exactly as indicated (however, input, output and plot formats are customizable; see gmtdefaults).


Add up multiple values that belong to the same node (same as -Az). Append n to simply count the number of data points that were assigned to each node. Append l or u to find the lowest (minimum) or upper (maximum) value at each node, respectively. [Default (no -A option) will calculate mean value]. Ignored if -Z is given.
Give values for xname, yname, zname, scale, offset, title, and remark. To leave some of these values untouched, specify = as the value. Alternatively, to allow "/" to be part of one of the values, use any non-alphanumeric character (and not the equal sign) as separator by both starting and ending with it. For example: -D:xname:yname:zname:scale:offset:title:remark:
Convert an ESRI ArcInfo ASCII interchange grid format file to a GMT grid. Append nodata which is a data value that should be set to NaN in the grid [Default is to read the optional 6th record in the file and get nodata]. The values normally given by -R, -I, and -F are determined from the ESRI header instead.
Force pixel node registration [Default is gridline registration]. (Node registrations are defined in GMT Cookbook Appendix B on grid file formats.)
Input file(s) has header record(s). If used, the default number of header records is N_HEADER_RECS. Use -Hi if only input data should have header records [Default will write out header records if the input data have them]. Blank lines and lines starting with # are always skipped. Not used with binary data.
No data. Set nodes with no input xyz triplet to this value [Default is NaN]. For z-tables, this option is used to replace z-values that equal nodata with NaN.
Swap the byte-order of the input only. No grid file is produced. You must also supply the -Z option. The output is written to zfile (or stdout if not supplied).
Selects verbose mode, which will send progress reports to stderr [Default runs "silently"].
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 flags. If incoming data represents 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 is 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 data are periodic in x but the incoming data do not contain the (redundant) column at x = xmax, append x. For data periodic in y without redundant row at y = ymax, append y. Append sn to skip the first n number of bytes (probably a header). If the byte-order needs to be swapped, append w. Select one of several data types (all binary except a):

       A ASCII representation of one or more floating point values per record

       a ASCII representation of a single item per record

       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 [architecture-dependent!]

       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 input. The difference between A and a is that the latter can decode both dateTclock and ddd:mm:ss[.xx] formats while the former is strictly for regular floating point values.

Toggles between (longitude,latitude) and (latitude,longitude) input and/or output. [Default is (longitude,latitude)]. Append i to select input only or o to select output only. [Default affects both].
Selects binary input. Append s for single precision [Default is d (double)]. Uppercase S or D will force byte-swapping. Optionally, append ncol, the number of columns in your binary input file if it exceeds the columns needed by the program. Or append c if the input file is netCDF. Optionally, append var1/var2/... to specify the variables to be read. [Default is 3 input columns]. This option only applies to xyz input files; see -Z for z tables.
Special formatting of input and/or output columns (time or geographical data). Specify i or o 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 T (absolute calendar time), t (relative time in chosen TIME_UNIT since TIME_EPOCH), x (longitude), y (latitude), or f (floating point) to each column or column range item. Shorthand -f[i|o]g means -f[i|o]0x,1y (geographic coordinates).


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.


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 2- or 4-byte integers. To specify the precision, scale and offset, the user should add the suffix =id[/scale/offset[/nan]], where id is a two-letter identifier of the grid type and precision, and scale and offset are optional scale factor and offset to be applied to all grid values, and nan is the value used to indicate missing data. See grdreformat(1) and Section 4.17 of the GMT Technical Reference and Cookbook for more information.

When writing a netCDF file, the grid is stored by default with the variable name "z". To specify another variable name varname, append ?varname to the file name. Note that you may need to escape the special meaning of ? in your shell program by putting a backslash in front of it, or by placing the filename and suffix between quotes or double quotes.


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 -f or -R options. For example, both -f0x -f1t and -R90w/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 .gmtdefaults file or on the command line. In addition, the unit attribute of the time variable will indicate both this unit and epoch.


To create a grid file from the ASCII data in, use

xyz2grd -Ddegree/degree/mGal/1/0/"Hawaiian Gravity"/"GRS-80 Ellipsoid used" -Ghawaii_grv_new.grd -R198/208/18/25 -I5m -V

To create a grid file from the raw binary (3-column, single-precision) scanline-oriented data raw.b, use

xyz2grd raw.b -Dm/m/m/1/0/=/= -Graw.grd -R0/100/0/100 -I1 -V -Z -b3

To make a grid file from the raw binary USGS DEM (short integer) scanline-oriented data topo30. 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

xyz2grd topo30. -Dm/m/m/1/0/=/= -Gustopo.grd -R234/294/24/50 -I30c -N-9999 -B -ZTLhw

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

xyz2grd floats.bin -Snew_floats.bin -V -Zf


GMT(1), grd2xyz(1), grdedit(1)
Le jeu est la forme la plus élevée de la recherche.
-+- Albert Einstein -+-