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 @@ -238,7 +238,6 @@ Use :func:`pygmt.datasets.load_sample_data` instead.
datasets.load_hotspots
datasets.load_mars_shape
datasets.load_ocean_ridge_points
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 @@ -15,7 +15,6 @@
load_hotspots,
load_mars_shape,
load_ocean_ridge_points,
load_sample_bathymetry,
load_sample_data,
load_usgs_quakes,
)
30 changes: 7 additions & 23 deletions pygmt/datasets/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
"ocean_ridge_points": load_ocean_ridge_points,
Expand All @@ -79,6 +78,8 @@ def load_sample_data(name):

# Dictionary of private load functions
load_func = {
"bathymetry": _load_sample_bathymetry,
Comment thread
michaelgrund marked this conversation as resolved.
Outdated
"rock_compositions": _load_rock_sample_compositions,
Comment thread
michaelgrund marked this conversation as resolved.
Outdated
"earth_relief_holes": _load_earth_relief_holes,
"fractures": _load_fractures_compilation,
"japan_quakes": _load_japan_quakes,
Expand Down Expand Up @@ -162,35 +163,18 @@ def load_ocean_ridge_points(**kwargs):
return data


def load_sample_bathymetry(**kwargs):
def _load_sample_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.
Comment thread
yvonnefroehlich marked this conversation as resolved.

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.
Comment thread
yvonnefroehlich marked this conversation as resolved.

Returns
-------
data : pandas.DataFrame
The data table. Columns are longitude, latitude, and bathymetry.
The data table. The column names are "longitude", "latitude",
and "bathymetry".
"""
Comment thread
michaelgrund marked this conversation as resolved.

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(
Comment thread
michaelgrund marked this conversation as resolved.
Outdated
fname, sep="\t", header=None, names=["longitude", "latitude", "bathymetry"]
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 @@ -8,7 +8,6 @@
load_hotspots,
load_mars_shape,
load_ocean_ridge_points,
load_sample_bathymetry,
load_sample_data,
load_usgs_quakes,
)
Expand Down Expand Up @@ -55,9 +54,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