Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions pygmt/src/grdsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,20 @@

import xarray as xr
from pygmt._typing import PathLike
from pygmt.alias import AliasSystem
from pygmt.alias import Alias, AliasSystem
from pygmt.clib import Session
from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias

__doctest_skip__ = ["grdsample"]


@fmt_docstring
@use_alias(
I="spacing",
T="translate",
f="coltypes",
n="interpolation",
r="registration",
)
@use_alias(I="spacing", f="coltypes", n="interpolation", r="registration")
@kwargs_to_strings(I="sequence")
def grdsample(
grid: PathLike | xr.DataArray,
outgrid: PathLike | None = None,
translate: bool = False,
region: Sequence[float | str] | str | None = None,
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
| bool = False,
Expand Down Expand Up @@ -61,9 +56,10 @@ def grdsample(
{outgrid}
{spacing}
{region}
translate : bool
Translate between grid and pixel registration; if the input is
grid-registered, the output will be pixel-registered and vice-versa.
translate
Translate between grid and pixel registration; if the input is grid-registered,
the output will be pixel-registered and vice-versa. This is a destructive grid
change.
registration : str or bool
[**g**\|\ **p**\ ].
Set registration to **g**\ ridline or **p**\ ixel.
Expand Down Expand Up @@ -93,7 +89,9 @@ def grdsample(
>>> # and set both x- and y-spacings to 0.5 arc-degrees
>>> new_grid = pygmt.grdsample(grid=grid, translate=True, spacing=[0.5, 0.5])
"""
aliasdict = AliasSystem().add_common(
aliasdict = AliasSystem(
T=Alias(translate, name="translate"),
).add_common(
R=region,
V=verbose,
x=cores,
Expand Down