Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_ocean_ridge_points
datasets.load_sample_bathymetry
datasets.load_usgs_quakes

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_ocean_ridge_points,
load_sample_bathymetry,
load_sample_data,
load_usgs_quakes,
Expand Down
37 changes: 10 additions & 27 deletions pygmt/datasets/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def load_sample_data(name):
"bathymetry": load_sample_bathymetry,
"hotspots": load_hotspots,
"mars_shape": load_mars_shape,
"ocean_ridge_points": load_ocean_ridge_points,
"usgs_quakes": load_usgs_quakes,
}

Expand All @@ -84,6 +83,7 @@ def load_sample_data(name):
"japan_quakes": _load_japan_quakes,
"maunaloa_co2": _load_maunaloa_co2,
"notre_dame_topography": _load_notre_dame_topography,
"ocean_ridge_points": _load_ocean_ridge_points,
"rock_compositions": _load_rock_sample_compositions,
}

Expand Down Expand Up @@ -125,41 +125,24 @@ def _load_japan_quakes():
)


def load_ocean_ridge_points(**kwargs):
def _load_ocean_ridge_points():
"""
(Deprecated) Load a table of ocean ridge points for the entire world as a
Load a table of ocean ridge points for the entire world as a
pandas.DataFrame.

.. warning:: Deprecated since v0.6.0. This function has been replaced with
``load_sample_data(name="ocean_ridge_points")`` and will be removed in
v0.9.0.

This is the ``@ridge.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.

Returns
-------
data : pandas.DataFrame
The data table. Columns are longitude and latitude.
The data table. The column names are "longitude" and "latitude".
"""

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='ocean_ridge_points') "
"instead.",
category=FutureWarning,
stacklevel=2,
)

fname = which("@ridge.txt", download="c")
data = pd.read_csv(
fname, sep=r"\s+", names=["longitude", "latitude"], skiprows=1, comment=">"
return pd.read_csv(
fname,
delim_whitespace=True,
names=["longitude", "latitude"],
skiprows=1,
comment=">",
)
return data


def load_sample_bathymetry(**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_ocean_ridge_points,
load_sample_bathymetry,
load_sample_data,
load_usgs_quakes,
Expand Down Expand Up @@ -41,9 +40,7 @@ def test_ocean_ridge_points():
"""
Check that the @ridge.txt dataset loads without errors.
"""
with pytest.warns(expected_warning=FutureWarning) as record:
data = load_ocean_ridge_points()
assert len(record) == 1
data = load_sample_data(name="ocean_ridge_points")
assert data.shape == (4146, 2)
assert data["longitude"].min() == -179.9401
assert data["longitude"].max() == 179.935
Expand Down