From 206810412edd51943acd6d1a151faec0d6beee98 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 15:00:29 +0100 Subject: [PATCH 01/17] 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..0f4b2c7eb6d 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -236,7 +236,6 @@ Use :func:`pygmt.datasets.load_sample_data` instead. :toctree: generated datasets.load_fractures_compilation - datasets.load_hotspots datasets.load_japan_quakes datasets.load_mars_shape datasets.load_ocean_ridge_points From b40272a3a42ac3af3dbea6197fe858ed36a879c7 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 15:03:07 +0100 Subject: [PATCH 02/17] 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..0c6b297d426 100644 --- a/pygmt/datasets/__init__.py +++ b/pygmt/datasets/__init__.py @@ -13,7 +13,6 @@ from pygmt.datasets.samples import ( list_sample_data, load_fractures_compilation, - load_hotspots, load_japan_quakes, load_mars_shape, load_ocean_ridge_points, From aa3b290136f3657c5cc8d6c5c328846ce3a7d879 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 15:04:52 +0100 Subject: [PATCH 03/17] Update samples.py --- pygmt/datasets/samples.py | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index 52cc349a1c8..0d45a5eae58 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -72,7 +72,6 @@ def load_sample_data(name): load_func_old = { "bathymetry": load_sample_bathymetry, "fractures": load_fractures_compilation, - "hotspots": load_hotspots, "japan_quakes": load_japan_quakes, "mars_shape": load_mars_shape, "ocean_ridge_points": load_ocean_ridge_points, @@ -83,6 +82,7 @@ def load_sample_data(name): load_func = { "rock_compositions": _load_rock_sample_compositions, "earth_relief_holes": _load_earth_relief_holes, + "hotspots": _load_hotspots, "maunaloa_co2": _load_maunaloa_co2, "notre_dame_topography": _load_notre_dame_topography, } @@ -285,24 +285,11 @@ def load_fractures_compilation(**kwargs): return data[["length", "azimuth"]] -def load_hotspots(**kwargs): +def _load_hotspots(): """ - (Deprecated) Load a table with the locations, names, and suggested symbol + Load a table with the locations, names, and suggested symbol sizes of hotspots. - .. warning:: Deprecated since v0.6.0. This function has been replaced with - ``load_sample_data(name="hotspots")`` and will be removed in - v0.9.0. - - This is the ``@hotspots.txt`` dataset used in the GMT tutorials, with data - from Mueller, Royer, and Lawver, 1993, Geology, vol. 21, pp. 275-278. The - main 5 hotspots used by Doubrovine et al. [2012] have symbol sizes twice - the size of all other hotspots. - - 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 @@ -310,14 +297,6 @@ def load_hotspots(**kwargs): "placename". """ - 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='hotspots') instead.", - category=FutureWarning, - stacklevel=2, - ) fname = which("@hotspots.txt", download="c") columns = ["longitude", "latitude", "symbol_size", "place_name"] data = pd.read_table(filepath_or_buffer=fname, sep="\t", skiprows=3, names=columns) From 9e477d7b3e076ddf593de7b6df2d06e5f8c09e41 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 15:06:11 +0100 Subject: [PATCH 04/17] 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..e2d99f72ee8 100644 --- a/pygmt/tests/test_datasets_samples.py +++ b/pygmt/tests/test_datasets_samples.py @@ -6,7 +6,6 @@ import pytest from pygmt.datasets import ( load_fractures_compilation, - load_hotspots, load_japan_quakes, load_mars_shape, load_ocean_ridge_points, @@ -129,9 +128,7 @@ def test_hotspots(): """ Check that the @hotspots.txt dataset loads without errors. """ - with pytest.warns(expected_warning=FutureWarning) as record: - data = load_hotspots() - assert len(record) == 1 + data = load_sample_data(name="hotspots") assert data.shape == (55, 4) assert list(data.columns) == [ "longitude", From ef8a6d4c6a9154db2f5925139d7690c875c6edb5 Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Wed, 4 Jan 2023 14:16:12 +0000 Subject: [PATCH 05/17] [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 0d45a5eae58..eeb79baa261 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -287,8 +287,8 @@ def load_fractures_compilation(**kwargs): def _load_hotspots(): """ - Load a table with the locations, names, and suggested symbol - sizes of hotspots. + Load a table with the locations, names, and suggested symbol sizes of + hotspots. Returns ------- From 6adbb2de5c340e20b4a05565f2541b1763d8f679 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 15:47:22 +0100 Subject: [PATCH 06/17] Apply suggestions from code review Co-authored-by: Will Schlitzer --- 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 eeb79baa261..a4f264b8400 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -288,7 +288,7 @@ def load_fractures_compilation(**kwargs): def _load_hotspots(): """ Load a table with the locations, names, and suggested symbol sizes of - hotspots. + hotspots as a pandas.DataFrame. Returns ------- From a1419c64d008af69c0a0051fe360dcb6f341b0c6 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Thu, 5 Jan 2023 14:04:38 +0100 Subject: [PATCH 07/17] Update pygmt/datasets/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 a4f264b8400..76e406fd86e 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -294,7 +294,7 @@ def _load_hotspots(): ------- data : pandas.DataFrame The data table with columns "longitude", "latitude", "symbol_size", and - "placename". + "place_name". """ fname = which("@hotspots.txt", download="c") From 955ce85eb8a597cb845d3b44c2e602dae2378303 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 9 Jan 2023 17:57:58 +0100 Subject: [PATCH 08/17] 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index 76e406fd86e..f3418e69355 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -289,11 +289,16 @@ def _load_hotspots(): """ Load a table with the locations, names, and suggested symbol sizes of hotspots as a pandas.DataFrame. + + The data is from Mueller, Royer, and Lawver, 1993, Geology, vol. 21, + pp. 275-278. The main 5 hotspots used by Doubrovine et al. [2012] + have symbol sizes twice the size of all other hotspots. Returns ------- data : pandas.DataFrame - The data table with columns "longitude", "latitude", "symbol_size", and + The data table. The column names are "longitude", "latitude", + "symbol_size", and "palce_name". "place_name". """ From 07d4e5a639fc17e151ba4a23b59166bba76aa731 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 9 Jan 2023 17:58:44 +0100 Subject: [PATCH 09/17] Apply suggestions from code review --- 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 f3418e69355..b628ba0d423 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -298,7 +298,7 @@ def _load_hotspots(): ------- data : pandas.DataFrame The data table. The column names are "longitude", "latitude", - "symbol_size", and "palce_name". + "symbol_size", and "place_name". "place_name". """ From 5f0a5d715f8fe1d9c826fd47b39b2fff545adc09 Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Mon, 9 Jan 2023 17:06:57 +0000 Subject: [PATCH 10/17] [format-command] fixes --- 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 f8ba1f60e72..3c873a05a39 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -256,7 +256,7 @@ def _load_hotspots(): """ Load a table with the locations, names, and suggested symbol sizes of hotspots as a pandas.DataFrame. - + The data is from Mueller, Royer, and Lawver, 1993, Geology, vol. 21, pp. 275-278. The main 5 hotspots used by Doubrovine et al. [2012] have symbol sizes twice the size of all other hotspots. From a765dbb6492db97369aec955bfb535a3263df614 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Tue, 10 Jan 2023 16:14:32 +0100 Subject: [PATCH 11/17] 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> Co-authored-by: Dongdong Tian --- 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 3c873a05a39..28f3fa7c2e9 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -257,7 +257,7 @@ def _load_hotspots(): Load a table with the locations, names, and suggested symbol sizes of hotspots as a pandas.DataFrame. - The data is from Mueller, Royer, and Lawver, 1993, Geology, vol. 21, + The data are from Mueller, Royer, and Lawver, 1993, Geology, vol. 21, pp. 275-278. The main 5 hotspots used by Doubrovine et al. [2012] have symbol sizes twice the size of all other hotspots. @@ -266,7 +266,6 @@ def _load_hotspots(): data : pandas.DataFrame The data table. The column names are "longitude", "latitude", "symbol_size", and "place_name". - "place_name". """ fname = which("@hotspots.txt", download="c") From d176e4d66eb249a2404088e7a703cf71eb12ada6 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 11 Jan 2023 09:09:45 +0100 Subject: [PATCH 12/17] Apply suggestions from code review Co-authored-by: Dongdong Tian --- 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 ee0b14d1cfe..b92fb77b2ee 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -270,7 +270,7 @@ def _load_hotspots(): fname = which("@hotspots.txt", download="c") columns = ["longitude", "latitude", "symbol_size", "place_name"] - data = pd.read_table(filepath_or_buffer=fname, sep="\t", skiprows=3, names=columns) + data = pd.read_csv(fname, delim_whitespace=True, skiprows=3, names=columns) return data From 3b251d8317d850ed82696c101474cfaae364400e Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 11 Jan 2023 19:28:36 +0100 Subject: [PATCH 13/17] Apply suggestions from code review Co-authored-by: Dongdong Tian --- pygmt/datasets/samples.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index b92fb77b2ee..9e43065dd6d 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -269,9 +269,7 @@ def _load_hotspots(): """ fname = which("@hotspots.txt", download="c") - columns = ["longitude", "latitude", "symbol_size", "place_name"] - data = pd.read_csv(fname, delim_whitespace=True, skiprows=3, names=columns) - return data + return pd.read_csv(fname, sep="\t", skiprows=3, names=["longitude", "latitude", "symbol_size", "place_name"]) def load_mars_shape(**kwargs): From 4ea0a4d10cad7bde5cf6be6409c4ce957c395f9b Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Thu, 12 Jan 2023 00:01:32 +0000 Subject: [PATCH 14/17] [format-command] fixes --- pygmt/datasets/samples.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index 9e43065dd6d..e43c463388c 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -269,7 +269,12 @@ def _load_hotspots(): """ fname = which("@hotspots.txt", download="c") - return pd.read_csv(fname, sep="\t", skiprows=3, names=["longitude", "latitude", "symbol_size", "place_name"]) + return pd.read_csv( + fname, + sep="\t", + skiprows=3, + names=["longitude", "latitude", "symbol_size", "place_name"], + ) def load_mars_shape(**kwargs): From 534b6222b05f8847083b40aefa35d41d6a10145a Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Thu, 12 Jan 2023 17:20:12 +0100 Subject: [PATCH 15/17] 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index e43c463388c..1663fe9ae9e 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -79,8 +79,8 @@ def load_sample_data(name): # Dictionary of private load functions load_func = { "earth_relief_holes": _load_earth_relief_holes, - "hotspots": _load_hotspots, "fractures": _load_fractures_compilation, + "hotspots": _load_hotspots, "japan_quakes": _load_japan_quakes, "maunaloa_co2": _load_maunaloa_co2, "notre_dame_topography": _load_notre_dame_topography, From 2488926ea133202c54db1f15b4634323f9ec133d Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Thu, 19 Jan 2023 08:42:55 +0100 Subject: [PATCH 16/17] Update test_datasets_samples.py --- pygmt/tests/test_datasets_samples.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pygmt/tests/test_datasets_samples.py b/pygmt/tests/test_datasets_samples.py index c15dde225eb..bb51defbf3b 100644 --- a/pygmt/tests/test_datasets_samples.py +++ b/pygmt/tests/test_datasets_samples.py @@ -117,6 +117,12 @@ def test_hotspots(): "place_name", ] assert isinstance(data, pd.DataFrame) + assert data["longitude"].min() == -169.6 + assert data["longitude"].max() == 167 + assert data["latitude"].min() == -78 + assert data["latitude"].max() == 64 + assert data["symbol_size"].min() == 0.25 + assert data["symbol_size"].max() == 0.5 def test_load_notre_dame_topography(): From fafd96b0351776c1c8347703c5b473b2adf29ac9 Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Thu, 19 Jan 2023 07:50:21 +0000 Subject: [PATCH 17/17] [format-command] fixes --- pygmt/tests/test_datasets_samples.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pygmt/tests/test_datasets_samples.py b/pygmt/tests/test_datasets_samples.py index db9f0e76099..57c5ab9f2f5 100644 --- a/pygmt/tests/test_datasets_samples.py +++ b/pygmt/tests/test_datasets_samples.py @@ -4,11 +4,7 @@ import numpy.testing as npt import pandas as pd import pytest -from pygmt.datasets import ( - load_mars_shape, - load_sample_data, - load_usgs_quakes, -) +from pygmt.datasets import load_mars_shape, load_sample_data, load_usgs_quakes from pygmt.exceptions import GMTInvalidInput