Skip to content

Commit

Permalink
Add missing aliases to grd2xyz (GenericMappingTools#1537)
Browse files Browse the repository at this point in the history
Co-authored-by: Meghan Jones <meghanj@alum.mit.edu>
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
  • Loading branch information
3 people authored and Josh Sixsmith committed Dec 21, 2022
1 parent c0ea969 commit 93a37da
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions pygmt/src/grd2xyz.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@

@fmt_docstring
@use_alias(
C="cstyle",
R="region",
V="verbose",
W="weight",
Z="convention",
b="binary",
d="nodata",
f="coltypes",
h="header",
o="outcols",
s="skiprows",
)
@kwargs_to_strings(R="sequence", o="sequence_comma")
def grd2xyz(grid, output_type="pandas", outfile=None, **kwargs):
Expand Down Expand Up @@ -48,12 +56,65 @@ def grd2xyz(grid, output_type="pandas", outfile=None, **kwargs):
- ``file`` - ASCII file (requires ``outfile``)
outfile : str
The file name for the output ASCII file.
cstyle : str
[**f**\|\ **i**].
Replace the x- and y-coordinates on output with the corresponding
column and row numbers. These start at 0 (C-style counting); append
**f** to start at 1 (Fortran-style counting). Alternatively, append
**i** to write just the two columns *index* and *z*, where *index*
is the 1-D indexing that GMT uses when referring to grid nodes.
{R}
Adding ``region`` will select a subsection of the grid. If this
subsection exceeds the boundaries of the grid, only the common region
will be output.
weight : str
[**a**\ [**+u**\ *unit*]\|\ *weight*].
Write out *x,y,z,w*\ , where *w* is the supplied *weight* (or 1 if not
supplied) [Default writes *x,y,z* only]. Choose **a** to compute
weights equal to the area each node represents. For Cartesian grids
this is simply the product of the *x* and *y* increments (except for
gridline-registered grids at all sides [half] and corners [quarter]).
For geographic grids we default to a length unit of **k**. Change
this by appending **+u**\ *unit*. For such grids, the area
varies with latitude and also sees special cases for
gridline-registered layouts at sides, corners, and poles.
{V}
convention : str
[*flags*].
Write a 1-column ASCII [or binary] table. Output will be organized
according to the specified ordering convention contained in *flags*.
If data should be written by 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 should start 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 grid is periodic in x but the written data should not
contain the (redundant) column at x = xmax, append **x**. For grid
periodic in y, skip writing the redundant row at y = ymax by
appending **y**. If the byte-order needs to be swapped, append
**w**. Select one of several data types (all binary except **a**):
* **a** ASCII representation of a single item per record
* **c** int8_t, signed 1-byte character
* **u** uint8_t, unsigned 1-byte character
* **h** int16_t, short 2-byte integer
* **H** uint16_t, unsigned short 2-byte integer
* **i** int32_t, 4-byte integer
* **I** uint32_t, unsigned 4-byte integer
* **l** int64_t, long (8-byte) integer
* **L** uint64_t, unsigned long (8-byte) integer
* **f** 4-byte floating point single precision
* **d** 8-byte floating point double precision
Default format is scanline orientation of ASCII numbers: **TLa**.
{b}
{d}
{f}
{h}
{o}
{s}
Returns
-------
Expand Down

0 comments on commit 93a37da

Please sign in to comment.