From 83b806ea617aace58401bfd5b58aa9020832a65a Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:11:58 +0100 Subject: [PATCH 01/11] Remove the deprecated load_fractures_compilation function (deprecated since v0.6.0) Related to #2302 --- doc/api/index.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/api/index.rst b/doc/api/index.rst index 618e95b6786..7f80f471ec9 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -235,7 +235,6 @@ Use :func:`pygmt.datasets.load_sample_data` instead. .. autosummary:: :toctree: generated - datasets.load_fractures_compilation datasets.load_hotspots datasets.load_japan_quakes datasets.load_mars_shape From 719f45fe7ba987c2bf8fb8eb85b7c749688a1f5b Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:14:02 +0100 Subject: [PATCH 02/11] 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..aacc7ce9ba6 100644 --- a/pygmt/datasets/__init__.py +++ b/pygmt/datasets/__init__.py @@ -12,7 +12,6 @@ ) from pygmt.datasets.samples import ( list_sample_data, - load_fractures_compilation, load_hotspots, load_japan_quakes, load_mars_shape, From ab5c1c63065cae52599f7993689a3fb539a913ee Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:19:08 +0100 Subject: [PATCH 03/11] Update samples.py --- pygmt/datasets/samples.py | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index 52cc349a1c8..415d76dd753 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -25,7 +25,6 @@ def list_sample_data(): names = { "bathymetry": "Table of ship bathymetric observations off Baja California", "earth_relief_holes": "Regional 20 arc-minutes Earth relief grid with holes", - "fractures": "Table of hypothetical fracture lengths and azimuths", "hotspots": "Table of locations, names, and symbol sizes of hotpots from " " Mueller et al., 1993", "japan_quakes": "Table of earthquakes around Japan from NOAA NGDC database", @@ -71,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, "mars_shape": load_mars_shape, @@ -83,6 +81,7 @@ def load_sample_data(name): load_func = { "rock_compositions": _load_rock_sample_compositions, "earth_relief_holes": _load_earth_relief_holes, + "fractures": _load_fractures_compilation, "maunaloa_co2": _load_maunaloa_co2, "notre_dame_topography": _load_notre_dame_topography, } @@ -250,20 +249,10 @@ def load_usgs_quakes(**kwargs): return data -def load_fractures_compilation(**kwargs): +def _load_fractures_compilation(): """ - (Deprecated) Load a table of fracture lengths and azimuths as - hypothetically digitized from geological maps as a pandas.DataFrame. - - .. warning:: Deprecated since v0.6.0. This function has been replaced with - ``load_sample_data(name="fractures")`` and will be removed in - v0.9.0. - - This is the ``@fractures_06.txt`` 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. + Load a table of fracture lengths and azimuths as hypothetically + digitized from geological maps as a pandas.DataFrame. Returns ------- @@ -272,14 +261,6 @@ def load_fractures_compilation(**kwargs): columns. """ - 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='fractures') instead.", - category=FutureWarning, - stacklevel=2, - ) fname = which("@fractures_06.txt", download="c") data = pd.read_csv(fname, header=None, sep=r"\s+", names=["azimuth", "length"]) return data[["length", "azimuth"]] From cbe123776693be4b61cf02b4dbdc0e56640177cd Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:21:44 +0100 Subject: [PATCH 04/11] 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..f77da41b17f 100644 --- a/pygmt/tests/test_datasets_samples.py +++ b/pygmt/tests/test_datasets_samples.py @@ -5,7 +5,6 @@ import pandas as pd import pytest from pygmt.datasets import ( - load_fractures_compilation, load_hotspots, load_japan_quakes, load_mars_shape, @@ -99,9 +98,7 @@ def test_fractures_compilation(): """ Check that the @fractures_06.txt dataset loads without errors. """ - with pytest.warns(expected_warning=FutureWarning) as record: - data = load_fractures_compilation() - assert len(record) == 1 + data = load_sample_data(name="fractures_compilation") assert data.shape == (361, 2) assert data["length"].min() == 98.6561 assert data["length"].max() == 984.652 From ee0ac8b1499b8896e757da978f83ddfaf1a0ca4c Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:23:06 +0100 Subject: [PATCH 05/11] Update test_datasets_samples.py --- pygmt/tests/test_datasets_samples.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/tests/test_datasets_samples.py b/pygmt/tests/test_datasets_samples.py index f77da41b17f..d964dccb1f5 100644 --- a/pygmt/tests/test_datasets_samples.py +++ b/pygmt/tests/test_datasets_samples.py @@ -98,7 +98,7 @@ def test_fractures_compilation(): """ Check that the @fractures_06.txt dataset loads without errors. """ - data = load_sample_data(name="fractures_compilation") + data = load_sample_data(name="fractures") assert data.shape == (361, 2) assert data["length"].min() == 98.6561 assert data["length"].max() == 984.652 From 5c94813edebfb29ce984dd580574e0861563e156 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:36:59 +0100 Subject: [PATCH 06/11] Update samples.py --- pygmt/datasets/samples.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index 415d76dd753..d49d0be6ffa 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -25,6 +25,7 @@ def list_sample_data(): names = { "bathymetry": "Table of ship bathymetric observations off Baja California", "earth_relief_holes": "Regional 20 arc-minutes Earth relief grid with holes", + "fractures": "Table of hypothetical fracture lengths and azimuths", "hotspots": "Table of locations, names, and symbol sizes of hotpots from " " Mueller et al., 1993", "japan_quakes": "Table of earthquakes around Japan from NOAA NGDC database", From f3e47bfcdd70ddf340a21805934842968fb30838 Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Wed, 4 Jan 2023 12:39:38 +0000 Subject: [PATCH 07/11] [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 d49d0be6ffa..81cd14d8bc4 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -252,8 +252,8 @@ def load_usgs_quakes(**kwargs): def _load_fractures_compilation(): """ - Load a table of fracture lengths and azimuths as hypothetically - digitized from geological maps as a pandas.DataFrame. + Load a table of fracture lengths and azimuths as hypothetically digitized + from geological maps as a pandas.DataFrame. Returns ------- From 1238a2688631cd8a82f6af599d02573832fe42c9 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 4 Jan 2023 14:56:23 +0100 Subject: [PATCH 08/11] 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 81cd14d8bc4..d5983473f4f 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -263,7 +263,7 @@ def _load_fractures_compilation(): """ fname = which("@fractures_06.txt", download="c") - data = pd.read_csv(fname, header=None, sep=r"\s+", names=["azimuth", "length"]) + data = pd.read_csv(fname, header=None, delim_whitespace=True, names=["azimuth", "length"]) return data[["length", "azimuth"]] From 82079f286157ca32cecc3d5d562b913850551c9d Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Fri, 6 Jan 2023 12:11:08 +0000 Subject: [PATCH 09/11] [format-command] fixes --- pygmt/datasets/samples.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index 498fbdc65e6..b09b69c7c9e 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -246,7 +246,9 @@ def _load_fractures_compilation(): """ fname = which("@fractures_06.txt", download="c") - data = pd.read_csv(fname, header=None, delim_whitespace=True, names=["azimuth", "length"]) + data = pd.read_csv( + fname, header=None, delim_whitespace=True, names=["azimuth", "length"] + ) return data[["length", "azimuth"]] From 2163ff9050b7cc4c9fd95a289d9d7b8cfe6da7c8 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Sun, 8 Jan 2023 00:00:22 +0100 Subject: [PATCH 10/11] Update samples.py --- pygmt/datasets/samples.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index b09b69c7c9e..b441893135e 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -241,8 +241,9 @@ def _load_fractures_compilation(): Returns ------- data : pandas.DataFrame - The data table. Use ``print(data.describe())`` to see the available - columns. + The data table. The column names are "length" and + "azimuth" of the fractures. + """ fname = which("@fractures_06.txt", download="c") From 3661ebade39bd5cb41d606d4f712bc1dcaa97de8 Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Sat, 7 Jan 2023 23:02:38 +0000 Subject: [PATCH 11/11] [format-command] fixes --- pygmt/datasets/samples.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index b441893135e..821e8c4ade1 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -243,7 +243,6 @@ def _load_fractures_compilation(): data : pandas.DataFrame The data table. The column names are "length" and "azimuth" of the fractures. - """ fname = which("@fractures_06.txt", download="c")