From 0e259d3343330a596ac85655da3994945b99cc51 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 5 May 2022 10:47:39 +0100 Subject: [PATCH 1/3] add inline example for sphinterpolate --- pygmt/src/sphinterpolate.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pygmt/src/sphinterpolate.py b/pygmt/src/sphinterpolate.py index 8a19cca64e7..d632ff479c6 100644 --- a/pygmt/src/sphinterpolate.py +++ b/pygmt/src/sphinterpolate.py @@ -11,6 +11,8 @@ ) from pygmt.io import load_dataarray +__doctest_skip__ = ["sphinterpolate"] + @fmt_docstring @use_alias( @@ -55,6 +57,14 @@ def sphinterpolate(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 + >>> # Load a file of the shape of Mars + >>> mars_shape = pygmt.datasets.load_sample_data("mars_shape") + >>> # Perform a Delaunay triangulation of the data + >>> grid = pygmt.sphinterpolate(data=mars_shape, spacing=1, region="g") """ with GMTTempFile(suffix=".nc") as tmpfile: with Session() as lib: From 6eb8adf04ccdbf83099c5abe74c7700195c2a608 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 5 May 2022 15:38:12 +0100 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/src/sphinterpolate.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pygmt/src/sphinterpolate.py b/pygmt/src/sphinterpolate.py index d632ff479c6..0114813927e 100644 --- a/pygmt/src/sphinterpolate.py +++ b/pygmt/src/sphinterpolate.py @@ -61,9 +61,10 @@ def sphinterpolate(data, **kwargs): Example ------- >>> import pygmt - >>> # Load a file of the shape of Mars - >>> mars_shape = pygmt.datasets.load_sample_data("mars_shape") - >>> # Perform a Delaunay triangulation of the data + >>> # Load a table of Mars with longitude/latitude/radius columns + >>> mars_shape = pygmt.datasets.load_sample_data(name="mars_shape") + >>> # Perform Delaunay triangulation on the table data + >>> # to produce a grid with a 1m spacing >>> grid = pygmt.sphinterpolate(data=mars_shape, spacing=1, region="g") """ with GMTTempFile(suffix=".nc") as tmpfile: From 3e58b5bbbd83ce8d605b96104564800114c3f337 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 5 May 2022 17:39:43 +0100 Subject: [PATCH 3/3] Update pygmt/src/sphinterpolate.py Co-authored-by: Dongdong Tian --- pygmt/src/sphinterpolate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/sphinterpolate.py b/pygmt/src/sphinterpolate.py index 0114813927e..551f9c62be2 100644 --- a/pygmt/src/sphinterpolate.py +++ b/pygmt/src/sphinterpolate.py @@ -64,7 +64,7 @@ def sphinterpolate(data, **kwargs): >>> # Load a table of Mars with longitude/latitude/radius columns >>> mars_shape = pygmt.datasets.load_sample_data(name="mars_shape") >>> # Perform Delaunay triangulation on the table data - >>> # to produce a grid with a 1m spacing + >>> # to produce a grid with a 1 arc-degree spacing >>> grid = pygmt.sphinterpolate(data=mars_shape, spacing=1, region="g") """ with GMTTempFile(suffix=".nc") as tmpfile: