1414
1515@fmt_docstring
1616@use_alias (
17+ A = "duplicate" ,
1718 G = "outgrid" ,
1819 I = "spacing" ,
20+ J = "projection" ,
1921 R = "region" ,
2022 V = "verbose" ,
23+ Z = "convention" ,
24+ b = "binary" ,
25+ d = "nodata" ,
26+ e = "find" ,
27+ f = "coltypes" ,
28+ h = "header" ,
29+ i = "incols" ,
30+ r = "registration" ,
31+ w = "wrap" ,
2132)
2233@kwargs_to_strings (R = "sequence" )
2334def xyz2grd (data = None , x = None , y = None , z = None , ** kwargs ):
24- """
35+ r """
2536 Create a grid file from table data.
2637
27- xyz2grd reads one or more z or xyz tables and creates a binary grid file.
28- xyz2grd will report if some of the nodes are not filled in with data. Such
29- unconstrained nodes are set to a value specified by the user [Default is
30- NaN]. Nodes with more than one value will be set to the mean value.
38+ Reads one or more tables with *x, y, z* columns and creates a binary grid
39+ file. xyz2grd will report if some of the nodes are not filled in with
40+ data. Such unconstrained nodes are set to a value specified by the user
41+ [Default is NaN]. Nodes with more than one value will be set to the mean
42+ value.
3143
3244 Full option list at :gmt-docs:`xyz2grd.html`
3345
46+ {aliases}
47+
3448 Parameters
3549 ----------
3650 data : str or {table-like}
@@ -41,9 +55,73 @@ def xyz2grd(data=None, x=None, y=None, z=None, **kwargs):
4155 outgrid : str or None
4256 Optional. The name of the output netCDF file with extension .nc to
4357 store the grid in.
58+ duplicate : str
59+ [**d**\|\ **f**\|\ **l**\|\ **m**\|\ **n**\|\
60+ **r**\|\ **S**\|\ **s**\|\ **u**\|\ **z**].
61+ By default we will calculate mean values if multiple entries fall on
62+ the same node. Use **-A** to change this behavior, except it is
63+ ignored if **-Z** is given. Append **f** or **s** to simply keep the
64+ first or last data point that was assigned to each node. Append
65+ **l** or **u** or **d** to find the lowest (minimum) or upper (maximum)
66+ value or the difference between the maximum and miminum value
67+ at each node, respectively. Append **m** or **r** or **S** to compute
68+ mean or RMS value or standard deviation at each node, respectively.
69+ Append **n** to simply count the number of data points that were
70+ assigned to each node (this only requires two input columns *x* and
71+ *y* as *z* is not consulted). Append **z** to sum multiple values that
72+ belong to the same node.
4473 {I}
74+ {J}
4575 {R}
4676 {V}
77+ convention : str
78+ [*flags*].
79+ Read a 1-column ASCII [or binary] table. This assumes that all the
80+ nodes are present and sorted according to specified ordering
81+ convention contained in *flags*. If incoming data represents rows,
82+ make *flags* start with **T**\ (op) if first row is y
83+ = ymax or **B**\ (ottom) if first row is y = ymin.
84+ Then, append **L** or **R** to indicate that first element is at
85+ left or right end of row. Likewise for column formats: start with
86+ **L** or **R** to position first column, and then append **T** or
87+ **B** to position first element in a row. **Note**: These two
88+ row/column indicators are only required for grids; for other tables
89+ they do not apply. For gridline registered grids: If data are periodic
90+ in x but the incoming data do not contain the (redundant) column at
91+ x = xmax, append **x**. For data periodic in y without redundant row at
92+ y = ymax, append **y**. Append **s**\ *n* to skip the first *n* number
93+ of bytes (probably a header). If the byte-order or the words needs
94+ to be swapped, append **w**. Select one of several data types (all
95+ binary except **a**):
96+
97+ - **A** ASCII representation of one or more floating point values per
98+ record
99+ - **a** ASCII representation of a single item per record
100+ - **c** int8_t, signed 1-byte character
101+ - **u** uint8_t, unsigned 1-byte character
102+ - **h** int16_t, signed 2-byte integer
103+ - **H** uint16_t, unsigned 2-byte integer
104+ - **i** int32_t, signed 4-byte integer
105+ - **I** uint32_t, unsigned 4-byte integer
106+ - **l** int64_t, long (8-byte) integer
107+ - **L** uint64_t, unsigned long (8-byte) integer
108+ - **f** 4-byte floating point single precision
109+ - **d** 8-byte floating point double precision
110+
111+ Default format is scanline orientation of ASCII numbers: **-ZTLa**.
112+ The difference between **A** and **a** is that the latter can decode
113+ both *date*\ **T**\ *clock* and *ddd:mm:ss[.xx]* formats but expects
114+ each input record to have a single value, while the former can handle
115+ multiple values per record but can only parse regular floating point
116+ values. Translate incoming *z*-values via the ``incols`` parameter.
117+ {b}
118+ {d}
119+ {e}
120+ {f}
121+ {h}
122+ {i}
123+ {r}
124+ {w}
47125
48126 Returns
49127 -------
0 commit comments