Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the deprecated load_sample_bathymetry function (deprecated since v0.6.0) #2305

Merged
merged 13 commits into from
Jan 18, 2023
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,
)
29 changes: 6 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,7 @@ def load_sample_data(name):

# Dictionary of private load functions
load_func = {
"bathymetry": _load_sample_bathymetry,
michaelgrund marked this conversation as resolved.
Show resolved Hide resolved
"earth_relief_holes": _load_earth_relief_holes,
"fractures": _load_fractures_compilation,
"japan_quakes": _load_japan_quakes,
Expand Down Expand Up @@ -162,35 +162,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.
yvonnefroehlich marked this conversation as resolved.
Show resolved Hide 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.
yvonnefroehlich marked this conversation as resolved.
Show resolved Hide 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".
"""

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(
michaelgrund marked this conversation as resolved.
Show resolved Hide resolved
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