|
18 | 18 |
|
19 | 19 | @fmt_docstring
|
20 | 20 | @use_alias(
|
| 21 | + C="cstyle", |
21 | 22 | R="region",
|
22 | 23 | V="verbose",
|
| 24 | + W="weight", |
| 25 | + Z="convention", |
| 26 | + b="binary", |
| 27 | + d="nodata", |
| 28 | + f="coltypes", |
| 29 | + h="header", |
23 | 30 | o="outcols",
|
| 31 | + s="skiprows", |
24 | 32 | )
|
25 | 33 | @kwargs_to_strings(R="sequence", o="sequence_comma")
|
26 | 34 | def grd2xyz(grid, output_type="pandas", outfile=None, **kwargs):
|
@@ -48,12 +56,65 @@ def grd2xyz(grid, output_type="pandas", outfile=None, **kwargs):
|
48 | 56 | - ``file`` - ASCII file (requires ``outfile``)
|
49 | 57 | outfile : str
|
50 | 58 | 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. |
51 | 66 | {R}
|
52 | 67 | Adding ``region`` will select a subsection of the grid. If this
|
53 | 68 | subsection exceeds the boundaries of the grid, only the common region
|
54 | 69 | 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. |
55 | 81 | {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} |
56 | 116 | {o}
|
| 117 | + {s} |
57 | 118 |
|
58 | 119 | Returns
|
59 | 120 | -------
|
|
0 commit comments