From 6908f88e90e1c1a0ab1b2382b039a22d4222e32d Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:48:24 +0100 Subject: [PATCH 01/10] Update index.rst --- doc/api/index.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/api/index.rst b/doc/api/index.rst index 618e95b6786..f3bc8e34012 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -240,7 +240,6 @@ Use :func:`pygmt.datasets.load_sample_data` instead. datasets.load_japan_quakes datasets.load_mars_shape datasets.load_ocean_ridge_points - datasets.load_sample_bathymetry datasets.load_usgs_quakes .. automodule:: pygmt.exceptions From a4fcd7dc903b6108987cf594c45b83036b6496d7 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:50:47 +0100 Subject: [PATCH 02/10] Update __init__.py --- pygmt/datasets/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pygmt/datasets/__init__.py b/pygmt/datasets/__init__.py index 87595e0b6bc..1553ec3a648 100644 --- a/pygmt/datasets/__init__.py +++ b/pygmt/datasets/__init__.py @@ -17,7 +17,6 @@ load_japan_quakes, load_mars_shape, load_ocean_ridge_points, - load_sample_bathymetry, load_sample_data, load_usgs_quakes, ) From 4d28e8c288a3962f41fb07b043c6273e9220aa2b Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:52:23 +0100 Subject: [PATCH 03/10] Update samples.py --- pygmt/datasets/samples.py | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index 52cc349a1c8..1f4aad83157 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -70,7 +70,6 @@ def load_sample_data(name): # Dictionary of public load functions for backwards compatibility load_func_old = { - "bathymetry": load_sample_bathymetry, "fractures": load_fractures_compilation, "hotspots": load_hotspots, "japan_quakes": load_japan_quakes, @@ -81,6 +80,7 @@ def load_sample_data(name): # Dictionary of private load functions load_func = { + "bathymetry": _load_sample_bathymetry, "rock_compositions": _load_rock_sample_compositions, "earth_relief_holes": _load_earth_relief_holes, "maunaloa_co2": _load_maunaloa_co2, @@ -179,35 +179,17 @@ def load_ocean_ridge_points(**kwargs): return data -def load_sample_bathymetry(**kwargs): +def _load_sample_bathymetry(**kwargs): """ - (Deprecated) Load a table of ship observations of bathymetry off Baja + Load a table of ship observations of bathymetry off Baja California as a pandas.DataFrame. - .. warning:: Deprecated since v0.6.0. This function has been replaced with - ``load_sample_data(name="bathymetry")`` and will be removed in - v0.9.0. - - This is the ``@tut_ship.xyz`` dataset used in the GMT tutorials. - - The data are downloaded to a cache directory (usually ``~/.gmt/cache``) the - first time you invoke this function. Afterwards, it will load the data from - the cache. So you'll need an internet connection the first time around. - Returns ------- data : pandas.DataFrame The data table. Columns are longitude, latitude, and bathymetry. """ - if "suppress_warning" not in kwargs: - warnings.warn( - "This function has been deprecated since v0.6.0 and will be " - "removed in v0.9.0. Please use " - "load_sample_data(name='bathymetry') instead.", - category=FutureWarning, - stacklevel=2, - ) fname = which("@tut_ship.xyz", download="c") data = pd.read_csv( fname, sep="\t", header=None, names=["longitude", "latitude", "bathymetry"] From 0c98772a79aa2ff710effd66be260a978f59b092 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:53:50 +0100 Subject: [PATCH 04/10] Update test_datasets_samples.py --- pygmt/tests/test_datasets_samples.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pygmt/tests/test_datasets_samples.py b/pygmt/tests/test_datasets_samples.py index 8fa1d8153ba..8437da1eb82 100644 --- a/pygmt/tests/test_datasets_samples.py +++ b/pygmt/tests/test_datasets_samples.py @@ -10,7 +10,6 @@ load_japan_quakes, load_mars_shape, load_ocean_ridge_points, - load_sample_bathymetry, load_sample_data, load_usgs_quakes, ) @@ -73,9 +72,7 @@ def test_sample_bathymetry(): """ Check that the @tut_ship.xyz dataset loads without errors. """ - with pytest.warns(expected_warning=FutureWarning) as record: - data = load_sample_bathymetry() - assert len(record) == 1 + data = load_sample_data(name="bathymetry") assert data.shape == (82970, 3) assert data["longitude"].min() == 245.0 assert data["longitude"].max() == 254.705 From b01f6564069206c44facbde813571597ba1f8199 Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Wed, 4 Jan 2023 12:55:07 +0000 Subject: [PATCH 05/10] [format-command] fixes --- pygmt/datasets/samples.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index 1f4aad83157..d3d010b38ea 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -181,8 +181,8 @@ def load_ocean_ridge_points(**kwargs): def _load_sample_bathymetry(**kwargs): """ - Load a table of ship observations of bathymetry off Baja - California as a pandas.DataFrame. + Load a table of ship observations of bathymetry off Baja California as a + pandas.DataFrame. Returns ------- From de092267f1f0b79bf5ff91da0cc0c07a1ba7470e Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 14:57:36 +0100 Subject: [PATCH 06/10] Update samples.py --- pygmt/datasets/samples.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index d3d010b38ea..ef981d81477 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -179,7 +179,7 @@ def load_ocean_ridge_points(**kwargs): return data -def _load_sample_bathymetry(**kwargs): +def _load_sample_bathymetry(): """ Load a table of ship observations of bathymetry off Baja California as a pandas.DataFrame. From b75c3ab9cebc27f8f1c5e15fdd3598fcfe3c7242 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Thu, 5 Jan 2023 14:02:15 +0100 Subject: [PATCH 07/10] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> --- pygmt/datasets/samples.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index ef981d81477..dbe1a048bf2 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -187,7 +187,8 @@ def _load_sample_bathymetry(): Returns ------- data : pandas.DataFrame - The data table. Columns are longitude, latitude, and bathymetry. + The data table. The column names are "longitude", "latitude", + and "bathymetry". """ fname = which("@tut_ship.xyz", download="c") From ce5e5a42d3bf37933f72c02b5fab7684977d7428 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 9 Jan 2023 18:04:29 +0100 Subject: [PATCH 08/10] Apply suggestions from code review --- pygmt/datasets/samples.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index fd38bbd29be..48af6f43b08 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -79,7 +79,6 @@ def load_sample_data(name): # Dictionary of private load functions load_func = { "bathymetry": _load_sample_bathymetry, - "rock_compositions": _load_rock_sample_compositions, "earth_relief_holes": _load_earth_relief_holes, "fractures": _load_fractures_compilation, "japan_quakes": _load_japan_quakes, From 1cdc28bb7a53331103b5a49666bd3a2e9d4b0abd Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 16 Jan 2023 08:55:40 +0100 Subject: [PATCH 09/10] Update samples.py --- pygmt/datasets/samples.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index 48af6f43b08..1ec67ed7e37 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -78,7 +78,7 @@ def load_sample_data(name): # Dictionary of private load functions load_func = { - "bathymetry": _load_sample_bathymetry, + "bathymetry": _load_baja_california_bathymetry, "earth_relief_holes": _load_earth_relief_holes, "fractures": _load_fractures_compilation, "japan_quakes": _load_japan_quakes, @@ -162,7 +162,7 @@ def load_ocean_ridge_points(**kwargs): return data -def _load_sample_bathymetry(): +def _load_baja_california_bathymetry(): """ Load a table of ship observations of bathymetry off Baja California as a pandas.DataFrame. From 897b5b1f2c74f9b996dc026d3804e2fcedbb3691 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 16 Jan 2023 14:36:22 +0100 Subject: [PATCH 10/10] Update samples.py --- pygmt/datasets/samples.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index bf469095c76..c657dad9083 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -158,10 +158,9 @@ def _load_baja_california_bathymetry(): """ fname = which("@tut_ship.xyz", download="c") - data = pd.read_csv( + return pd.read_csv( fname, sep="\t", header=None, names=["longitude", "latitude", "bathymetry"] ) - return data def load_usgs_quakes(**kwargs):