Skip to content
Merged
1 change: 0 additions & 1 deletion doc/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pygmt/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
list_sample_data,
load_hotspots,
load_mars_shape,
load_sample_bathymetry,
load_sample_data,
load_usgs_quakes,
)
32 changes: 7 additions & 25 deletions pygmt/datasets/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ 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,
}

# 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,
Expand Down Expand Up @@ -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):
Expand Down
5 changes: 1 addition & 4 deletions pygmt/tests/test_datasets_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from pygmt.datasets import (
load_hotspots,
load_mars_shape,
load_sample_bathymetry,
load_sample_data,
load_usgs_quakes,
)
Expand Down Expand Up @@ -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
Expand Down