From 3a9cce8866db85d4196f5ce6c66f3562c2a6a56c Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 6 Mar 2022 23:22:14 +0000 Subject: [PATCH] Add inline example for sph2grd (#1718) Add an inline example for the sph2grd documentation. Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Co-authored-by: Dongdong Tian --- pygmt/src/sph2grd.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pygmt/src/sph2grd.py b/pygmt/src/sph2grd.py index 114c1df6bf9..163f420c540 100644 --- a/pygmt/src/sph2grd.py +++ b/pygmt/src/sph2grd.py @@ -63,6 +63,15 @@ def sph2grd(data, **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 + >>> # Create a new grid from the remote file "EGM96_to_36.txt", + >>> # set the grid spacing to 1, and the region to "g" + >>> new_grid = pygmt.sph2grd( + ... data="@EGM96_to_36.txt", spacing=1, region="g" + ... ) # doctest: +SKIP """ with GMTTempFile(suffix=".nc") as tmpfile: with Session() as lib: