|
7 | 7 |
|
8 | 8 | import xarray as xr |
9 | 9 | from pygmt._typing import PathLike |
10 | | -from pygmt.alias import AliasSystem |
| 10 | +from pygmt.alias import Alias, AliasSystem |
11 | 11 | from pygmt.clib import Session |
12 | 12 | from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias |
13 | 13 |
|
14 | 14 | __doctest_skip__ = ["grdsample"] |
15 | 15 |
|
16 | 16 |
|
17 | 17 | @fmt_docstring |
18 | | -@use_alias( |
19 | | - I="spacing", |
20 | | - T="translate", |
21 | | - f="coltypes", |
22 | | - n="interpolation", |
23 | | - r="registration", |
24 | | -) |
| 18 | +@use_alias(I="spacing", f="coltypes", n="interpolation", r="registration") |
25 | 19 | @kwargs_to_strings(I="sequence") |
26 | 20 | def grdsample( |
27 | 21 | grid: PathLike | xr.DataArray, |
28 | 22 | outgrid: PathLike | None = None, |
| 23 | + translate: bool = False, |
29 | 24 | region: Sequence[float | str] | str | None = None, |
30 | 25 | verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] |
31 | 26 | | bool = False, |
@@ -61,9 +56,10 @@ def grdsample( |
61 | 56 | {outgrid} |
62 | 57 | {spacing} |
63 | 58 | {region} |
64 | | - translate : bool |
65 | | - Translate between grid and pixel registration; if the input is |
66 | | - grid-registered, the output will be pixel-registered and vice-versa. |
| 59 | + translate |
| 60 | + Translate between grid and pixel registration; if the input is grid-registered, |
| 61 | + the output will be pixel-registered and vice-versa. This is a *destructive* grid |
| 62 | + change; see :gmt-docs:`reference/options.html#switch-registrations`. |
67 | 63 | registration : str or bool |
68 | 64 | [**g**\|\ **p**\ ]. |
69 | 65 | Set registration to **g**\ ridline or **p**\ ixel. |
@@ -93,7 +89,9 @@ def grdsample( |
93 | 89 | >>> # and set both x- and y-spacings to 0.5 arc-degrees |
94 | 90 | >>> new_grid = pygmt.grdsample(grid=grid, translate=True, spacing=[0.5, 0.5]) |
95 | 91 | """ |
96 | | - aliasdict = AliasSystem().add_common( |
| 92 | + aliasdict = AliasSystem( |
| 93 | + T=Alias(translate, name="translate"), |
| 94 | + ).add_common( |
97 | 95 | R=region, |
98 | 96 | V=verbose, |
99 | 97 | x=cores, |
|
0 commit comments