From b8e2be72a63e072f69b55a97ccd4eaaaef8a898d Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 5 Feb 2022 15:19:29 +0000 Subject: [PATCH 1/5] add inline example to grdtrack.py --- pygmt/src/grdtrack.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pygmt/src/grdtrack.py b/pygmt/src/grdtrack.py index 6e0e6d91431..a2f75670403 100644 --- a/pygmt/src/grdtrack.py +++ b/pygmt/src/grdtrack.py @@ -264,6 +264,22 @@ def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs): ``outfile`` is not set - None if ``outfile`` is set (track output will be stored in file set by ``outfile``) + + Example + ------- + >>> import pygmt # doctest: +SKIP + >>> # Load a grid of @earth_relief_30m data, with an x-range of -118 to + >>> # -107, and a y-range of -49 to -42 + >>> grid = pygmt.datasets.load_earth_relief( + ... resolution="30m", region=[-118, -107, -49, -42] + ... ) # doctest: +SKIP + >>> # Load a pandas dataframe with ocean ridge points + >>> points = pygmt.datasets.load_ocean_ridge_points() # doctest: +SKIP + >>> # Create a pandas dataframe from an input grid and set of points + >>> # The output dataframe adds a column named "bathymetry" + >>> output_dataframe = pygmt.grdtrack( + ... points=dataframe, grid=grid, newcolname="bathymetry" + ... ) # doctest: +SKIP """ if hasattr(points, "columns") and newcolname is None: raise GMTInvalidInput("Please pass in a str to 'newcolname'") From 8560eeb1d84bd5e5b2c9d7906baa20b71158a3cd Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 11 Feb 2022 17:57:32 +0000 Subject: [PATCH 2/5] Update pygmt/src/grdtrack.py Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com> --- pygmt/src/grdtrack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/grdtrack.py b/pygmt/src/grdtrack.py index a2f75670403..1b81d831889 100644 --- a/pygmt/src/grdtrack.py +++ b/pygmt/src/grdtrack.py @@ -278,7 +278,7 @@ def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs): >>> # Create a pandas dataframe from an input grid and set of points >>> # The output dataframe adds a column named "bathymetry" >>> output_dataframe = pygmt.grdtrack( - ... points=dataframe, grid=grid, newcolname="bathymetry" + ... points=points, grid=grid, newcolname="bathymetry" ... ) # doctest: +SKIP """ if hasattr(points, "columns") and newcolname is None: From 27d4723fffbf69d8264b764d8d1d0a9c0613f8de Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 11 Mar 2022 08:43:27 +0000 Subject: [PATCH 3/5] update doctest skip format --- pygmt/src/grdtrack.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pygmt/src/grdtrack.py b/pygmt/src/grdtrack.py index 1b81d831889..b4d8827d7f1 100644 --- a/pygmt/src/grdtrack.py +++ b/pygmt/src/grdtrack.py @@ -12,6 +12,8 @@ use_alias, ) +__doctest_skip__ = ["grdtrack"] + @fmt_docstring @use_alias( @@ -267,19 +269,19 @@ def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs): Example ------- - >>> import pygmt # doctest: +SKIP + >>> import pygmt >>> # Load a grid of @earth_relief_30m data, with an x-range of -118 to >>> # -107, and a y-range of -49 to -42 >>> grid = pygmt.datasets.load_earth_relief( ... resolution="30m", region=[-118, -107, -49, -42] - ... ) # doctest: +SKIP + ... ) >>> # Load a pandas dataframe with ocean ridge points >>> points = pygmt.datasets.load_ocean_ridge_points() # doctest: +SKIP >>> # Create a pandas dataframe from an input grid and set of points >>> # The output dataframe adds a column named "bathymetry" >>> output_dataframe = pygmt.grdtrack( ... points=points, grid=grid, newcolname="bathymetry" - ... ) # doctest: +SKIP + ... ) """ if hasattr(points, "columns") and newcolname is None: raise GMTInvalidInput("Please pass in a str to 'newcolname'") From b0d17208167571cb7c8c7373c7fb58bf75c8e8d2 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 11 Mar 2022 23:10:24 +0800 Subject: [PATCH 4/5] Fix the inline example --- pygmt/src/grdtrack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/grdtrack.py b/pygmt/src/grdtrack.py index b4d8827d7f1..79e76626c43 100644 --- a/pygmt/src/grdtrack.py +++ b/pygmt/src/grdtrack.py @@ -276,7 +276,7 @@ def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs): ... resolution="30m", region=[-118, -107, -49, -42] ... ) >>> # Load a pandas dataframe with ocean ridge points - >>> points = pygmt.datasets.load_ocean_ridge_points() # doctest: +SKIP + >>> points = pygmt.datasets.load_sample_data(name='ocean_ridge_points') >>> # Create a pandas dataframe from an input grid and set of points >>> # The output dataframe adds a column named "bathymetry" >>> output_dataframe = pygmt.grdtrack( From fa43f25a28c2b2cf72e38e7c7ea6de5ed0351063 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 11 Mar 2022 18:28:13 +0000 Subject: [PATCH 5/5] Update pygmt/src/grdtrack.py Co-authored-by: Meghan Jones --- pygmt/src/grdtrack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/grdtrack.py b/pygmt/src/grdtrack.py index 79e76626c43..1f15161b99c 100644 --- a/pygmt/src/grdtrack.py +++ b/pygmt/src/grdtrack.py @@ -276,7 +276,7 @@ def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs): ... resolution="30m", region=[-118, -107, -49, -42] ... ) >>> # Load a pandas dataframe with ocean ridge points - >>> points = pygmt.datasets.load_sample_data(name='ocean_ridge_points') + >>> points = pygmt.datasets.load_sample_data(name="ocean_ridge_points") >>> # Create a pandas dataframe from an input grid and set of points >>> # The output dataframe adds a column named "bathymetry" >>> output_dataframe = pygmt.grdtrack(