diff --git a/doc/api/index.rst b/doc/api/index.rst index 08d9a23ec3f..448ca2c50ce 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -237,7 +237,6 @@ Use :func:`pygmt.datasets.load_sample_data` instead. datasets.load_hotspots datasets.load_mars_shape - datasets.load_sample_bathymetry datasets.load_usgs_quakes .. automodule:: pygmt.exceptions diff --git a/pygmt/datasets/__init__.py b/pygmt/datasets/__init__.py index 3a00936ef26..1a395f1e160 100644 --- a/pygmt/datasets/__init__.py +++ b/pygmt/datasets/__init__.py @@ -14,7 +14,6 @@ list_sample_data, load_hotspots, load_mars_shape, - load_sample_bathymetry, load_sample_data, load_usgs_quakes, ) diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index fe52f4bbc39..c657dad9083 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, "hotspots": load_hotspots, "mars_shape": load_mars_shape, "usgs_quakes": load_usgs_quakes, @@ -78,6 +77,7 @@ def load_sample_data(name): # Dictionary of private load functions load_func = { + "bathymetry": _load_baja_california_bathymetry, "earth_relief_holes": _load_earth_relief_holes, "fractures": _load_fractures_compilation, "japan_quakes": _load_japan_quakes, @@ -145,40 +145,22 @@ def _load_ocean_ridge_points(): ) -def load_sample_bathymetry(**kwargs): +def _load_baja_california_bathymetry(): """ - (Deprecated) 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. + Load a table of ship observations of bathymetry off Baja California as a + pandas.DataFrame. Returns ------- data : pandas.DataFrame - The data table. Columns are longitude, latitude, and bathymetry. + The data table. The column names 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( + return pd.read_csv( fname, sep="\t", header=None, names=["longitude", "latitude", "bathymetry"] ) - return data def load_usgs_quakes(**kwargs): diff --git a/pygmt/tests/test_datasets_samples.py b/pygmt/tests/test_datasets_samples.py index cbfae696984..9fa5bab3728 100644 --- a/pygmt/tests/test_datasets_samples.py +++ b/pygmt/tests/test_datasets_samples.py @@ -7,7 +7,6 @@ from pygmt.datasets import ( load_hotspots, load_mars_shape, - load_sample_bathymetry, load_sample_data, load_usgs_quakes, ) @@ -52,9 +51,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