From 31b9edff5b4b251d9efe1ab81262209feb1fce0c Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 20 Feb 2022 09:32:33 +0000 Subject: [PATCH] Add inline example for grdsample (#1724) Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com> --- pygmt/src/grdsample.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pygmt/src/grdsample.py b/pygmt/src/grdsample.py index 4acd7bc0fe5..917ee79df3b 100644 --- a/pygmt/src/grdsample.py +++ b/pygmt/src/grdsample.py @@ -73,6 +73,20 @@ def grdsample(grid, **kwargs): - :class:`xarray.DataArray` if ``outgrid`` is not set - None if ``outgrid`` is set (grid output will be stored in file set by ``outgrid``) + + Example + ------- + >>> import pygmt # doctest: +SKIP + >>> # Load a grid of @earth_relief_30m data, with an x-range of 10 to 30, + >>> # and a y-range of 15 to 25 + >>> grid = pygmt.datasets.load_earth_relief( + ... resolution="30m", region=[10, 30, 15, 25] + ... ) # doctest: +SKIP + >>> # Create a new grid from an input grid, change the registration, + >>> # and set both x- and y-spacing to 0.5 degrees + >>> new_grid = pygmt.grdsample( + ... grid=grid, translate=True, spacing=[0.5, 0.5] + ... ) # doctest: +SKIP """ with GMTTempFile(suffix=".nc") as tmpfile: with Session() as lib: