Skip to content

Commit 9e95a4e

Browse files
willschlitzerMeghan Jonesweiji14
authored
Add missing aliases to grd2xyz (#1537)
Co-authored-by: Meghan Jones <[email protected]> Co-authored-by: Wei Ji <[email protected]>
1 parent 30df670 commit 9e95a4e

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

pygmt/src/grd2xyz.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@
1818

1919
@fmt_docstring
2020
@use_alias(
21+
C="cstyle",
2122
R="region",
2223
V="verbose",
24+
W="weight",
25+
Z="convention",
26+
b="binary",
27+
d="nodata",
28+
f="coltypes",
29+
h="header",
2330
o="outcols",
31+
s="skiprows",
2432
)
2533
@kwargs_to_strings(R="sequence", o="sequence_comma")
2634
def grd2xyz(grid, output_type="pandas", outfile=None, **kwargs):
@@ -48,12 +56,65 @@ def grd2xyz(grid, output_type="pandas", outfile=None, **kwargs):
4856
- ``file`` - ASCII file (requires ``outfile``)
4957
outfile : str
5058
The file name for the output ASCII file.
59+
cstyle : str
60+
[**f**\|\ **i**].
61+
Replace the x- and y-coordinates on output with the corresponding
62+
column and row numbers. These start at 0 (C-style counting); append
63+
**f** to start at 1 (Fortran-style counting). Alternatively, append
64+
**i** to write just the two columns *index* and *z*, where *index*
65+
is the 1-D indexing that GMT uses when referring to grid nodes.
5166
{R}
5267
Adding ``region`` will select a subsection of the grid. If this
5368
subsection exceeds the boundaries of the grid, only the common region
5469
will be output.
70+
weight : str
71+
[**a**\ [**+u**\ *unit*]\|\ *weight*].
72+
Write out *x,y,z,w*\ , where *w* is the supplied *weight* (or 1 if not
73+
supplied) [Default writes *x,y,z* only]. Choose **a** to compute
74+
weights equal to the area each node represents. For Cartesian grids
75+
this is simply the product of the *x* and *y* increments (except for
76+
gridline-registered grids at all sides [half] and corners [quarter]).
77+
For geographic grids we default to a length unit of **k**. Change
78+
this by appending **+u**\ *unit*. For such grids, the area
79+
varies with latitude and also sees special cases for
80+
gridline-registered layouts at sides, corners, and poles.
5581
{V}
82+
convention : str
83+
[*flags*].
84+
Write a 1-column ASCII [or binary] table. Output will be organized
85+
according to the specified ordering convention contained in *flags*.
86+
If data should be written by rows, make *flags* start with
87+
**T** (op) if first row is y = ymax or
88+
**B** (ottom) if first row is y = ymin. Then,
89+
append **L** or **R** to indicate that first element should start at
90+
left or right end of row. Likewise for column formats: start with
91+
**L** or **R** to position first column, and then append **T** or
92+
**B** to position first element in a row. For gridline registered
93+
grids: If grid is periodic in x but the written data should not
94+
contain the (redundant) column at x = xmax, append **x**. For grid
95+
periodic in y, skip writing the redundant row at y = ymax by
96+
appending **y**. If the byte-order needs to be swapped, append
97+
**w**. Select one of several data types (all binary except **a**):
98+
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, short 2-byte integer
103+
* **H** uint16_t, unsigned short 2-byte integer
104+
* **i** int32_t, 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: **TLa**.
112+
{b}
113+
{d}
114+
{f}
115+
{h}
56116
{o}
117+
{s}
57118
58119
Returns
59120
-------

0 commit comments

Comments
 (0)