From 0404c25657871c603d952df942b8a3a78fc7fdaa Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Sun, 13 Feb 2022 19:02:14 +0100 Subject: [PATCH 1/5] Add inline example for select Addresses #1686 --- pygmt/src/select.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pygmt/src/select.py b/pygmt/src/select.py index 2c8256cad6f..8c5521ccfac 100644 --- a/pygmt/src/select.py +++ b/pygmt/src/select.py @@ -147,6 +147,16 @@ def select(data=None, outfile=None, **kwargs): - :class:`pandas.DataFrame` table if ``outfile`` is not set. - None if ``outfile`` is set (filtered output will be stored in file set by ``outfile``). + + Example + ------- + >>> import pygmt # doctest: +SKIP + >>> # Load a table of ship observations of bathymetry off Baja California + >>> data = pygmt.datasets.load_sample_data(name="bathymetry") + >>> # Only return the data points that lie within the region between + ... longitudes 246 and 247 and latitudes 20 and 21 + >>> pygmt.select(data=ship_data, region=[246,247,20,21]) + ... ) # doctest: +SKIP """ with GMTTempFile(suffix=".csv") as tmpfile: From daca3915f21830402a8e316bb6eccbae9e0ea254 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Sun, 13 Feb 2022 19:11:26 +0100 Subject: [PATCH 2/5] update --- pygmt/src/select.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pygmt/src/select.py b/pygmt/src/select.py index 8c5521ccfac..0ce1705e1d4 100644 --- a/pygmt/src/select.py +++ b/pygmt/src/select.py @@ -147,16 +147,16 @@ def select(data=None, outfile=None, **kwargs): - :class:`pandas.DataFrame` table if ``outfile`` is not set. - None if ``outfile`` is set (filtered output will be stored in file set by ``outfile``). - + Example ------- >>> import pygmt # doctest: +SKIP >>> # Load a table of ship observations of bathymetry off Baja California >>> data = pygmt.datasets.load_sample_data(name="bathymetry") - >>> # Only return the data points that lie within the region between - ... longitudes 246 and 247 and latitudes 20 and 21 + >>> # Only return the data points that lie within the region between + >>> # longitudes 246 and 247 and latitudes 20 and 21 >>> pygmt.select(data=ship_data, region=[246,247,20,21]) - ... ) # doctest: +SKIP + ... ) # doctest: +SKIP """ with GMTTempFile(suffix=".csv") as tmpfile: From f4ba44ee9689d44995c1bb37a5d3900c6a9d5599 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Tue, 15 Feb 2022 10:37:38 +0100 Subject: [PATCH 3/5] Update pygmt/src/select.py Co-authored-by: Will Schlitzer --- pygmt/src/select.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/select.py b/pygmt/src/select.py index 0ce1705e1d4..5a243adcd50 100644 --- a/pygmt/src/select.py +++ b/pygmt/src/select.py @@ -152,7 +152,7 @@ def select(data=None, outfile=None, **kwargs): ------- >>> import pygmt # doctest: +SKIP >>> # Load a table of ship observations of bathymetry off Baja California - >>> data = pygmt.datasets.load_sample_data(name="bathymetry") + >>> data = pygmt.datasets.load_sample_data(name="bathymetry") # doctest: +SKIP >>> # Only return the data points that lie within the region between >>> # longitudes 246 and 247 and latitudes 20 and 21 >>> pygmt.select(data=ship_data, region=[246,247,20,21]) From 572d38ee438c52873e0c0a578701eb1e48f9c30b Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 21 Feb 2022 17:54:19 +0100 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: Dongdong Tian --- pygmt/src/select.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pygmt/src/select.py b/pygmt/src/select.py index 5a243adcd50..d15a809c3a5 100644 --- a/pygmt/src/select.py +++ b/pygmt/src/select.py @@ -155,8 +155,7 @@ def select(data=None, outfile=None, **kwargs): >>> data = pygmt.datasets.load_sample_data(name="bathymetry") # doctest: +SKIP >>> # Only return the data points that lie within the region between >>> # longitudes 246 and 247 and latitudes 20 and 21 - >>> pygmt.select(data=ship_data, region=[246,247,20,21]) - ... ) # doctest: +SKIP + >>> pygmt.select(data=ship_data, region=[246, 247, 20, 21]) # doctest: +SKIP """ with GMTTempFile(suffix=".csv") as tmpfile: From d75abb0d96ba7374cfebb6348e2f818eef8952c8 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Tue, 1 Mar 2022 18:08:44 +0100 Subject: [PATCH 5/5] Apply suggestions from code review Co-authored-by: Dongdong Tian --- pygmt/src/select.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pygmt/src/select.py b/pygmt/src/select.py index d15a809c3a5..777ea58ea82 100644 --- a/pygmt/src/select.py +++ b/pygmt/src/select.py @@ -152,10 +152,14 @@ def select(data=None, outfile=None, **kwargs): ------- >>> import pygmt # doctest: +SKIP >>> # Load a table of ship observations of bathymetry off Baja California - >>> data = pygmt.datasets.load_sample_data(name="bathymetry") # doctest: +SKIP + >>> data = pygmt.datasets.load_sample_data( + ... name="bathymetry" + ... ) # doctest: +SKIP >>> # Only return the data points that lie within the region between >>> # longitudes 246 and 247 and latitudes 20 and 21 - >>> pygmt.select(data=ship_data, region=[246, 247, 20, 21]) # doctest: +SKIP + >>> pygmt.select( + ... data=ship_data, region=[246, 247, 20, 21] + ... ) # doctest: +SKIP """ with GMTTempFile(suffix=".csv") as tmpfile: