diff --git a/doc/api/index.rst b/doc/api/index.rst index d8fdd877c1c..cf017a475bd 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -227,13 +227,6 @@ and store them in GMT's user data directory. datasets.load_earth_vertical_gravity_gradient datasets.load_sample_data -The following functions are deprecated since v0.6.0 and will be removed in v0.9.0. -Use :func:`pygmt.datasets.load_sample_data` instead. - -.. autosummary:: - :toctree: generated - - datasets.load_mars_shape .. currentmodule:: pygmt diff --git a/pygmt/datasets/__init__.py b/pygmt/datasets/__init__.py index 37841dfdd2d..d7a099972fb 100644 --- a/pygmt/datasets/__init__.py +++ b/pygmt/datasets/__init__.py @@ -13,4 +13,4 @@ from pygmt.datasets.earth_vertical_gravity_gradient import ( load_earth_vertical_gravity_gradient, ) -from pygmt.datasets.samples import list_sample_data, load_mars_shape, load_sample_data +from pygmt.datasets.samples import list_sample_data, load_sample_data diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index aeb4f398436..15477e18358 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -1,8 +1,6 @@ """ Functions to load sample data. """ -import warnings - import pandas as pd from pygmt.exceptions import GMTInvalidInput from pygmt.io import load_dataarray @@ -68,11 +66,6 @@ def load_sample_data(name): if name not in names: raise GMTInvalidInput(f"Invalid dataset name '{name}'.") - # Dictionary of public load functions for backwards compatibility - load_func_old = { - "mars_shape": load_mars_shape, - } - # Dictionary of private load functions load_func = { "bathymetry": _load_baja_california_bathymetry, @@ -80,19 +73,14 @@ def load_sample_data(name): "fractures": _load_fractures_compilation, "hotspots": _load_hotspots, "japan_quakes": _load_japan_quakes, + "mars_shape": _load_mars_shape, "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, "usgs_quakes": _load_usgs_quakes, } - - if name in load_func_old: - data = load_func_old[name](suppress_warning=True) - elif name in load_func: - data = load_func[name]() - - return data + return load_func[name]() def _load_japan_quakes(): @@ -221,40 +209,23 @@ def _load_hotspots(): ) -def load_mars_shape(**kwargs): +def _load_mars_shape(): """ - (Deprecated) Load a table of data for the shape of Mars. + Load a table of data for the shape of Mars as a pandas.DataFrame. - .. warning:: Deprecated since v0.6.0. This function has been replaced with - ``load_sample_data(name="mars_shape")`` and will be removed in - v0.9.0. - - This is the ``@mars370d.txt`` dataset used in GMT examples, with data and - information from Smith, D. E., and M. T. Zuber (1996), The shape of Mars - and the topographic signature of the hemispheric dichotomy. Data columns - are "longitude," "latitude", and "radius (meters)." - - 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. + Data and information are from Smith, D. E., and M. T. Zuber (1996), + The shape of Mars and the topographic signature of the hemispheric + dichotomy. Returns ------- data : pandas.DataFrame - The data table with columns "longitude", "latitude", and "radius(m)". + The data table with column names "longitude", "latitude", and + "radius_m". """ - - 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='mars_shape') instead.", - category=FutureWarning, - stacklevel=2, - ) fname = which("@mars370d.txt", download="c") data = pd.read_csv( - fname, sep="\t", header=None, names=["longitude", "latitude", "radius(m)"] + fname, sep="\t", header=None, names=["longitude", "latitude", "radius_m"] ) return data diff --git a/pygmt/tests/test_datasets_samples.py b/pygmt/tests/test_datasets_samples.py index ddf71afc863..010a58746d9 100644 --- a/pygmt/tests/test_datasets_samples.py +++ b/pygmt/tests/test_datasets_samples.py @@ -4,7 +4,7 @@ import numpy.testing as npt import pandas as pd import pytest -from pygmt.datasets import load_mars_shape, load_sample_data +from pygmt.datasets import load_sample_data from pygmt.exceptions import GMTInvalidInput @@ -128,16 +128,14 @@ def test_mars_shape(): """ Check that the @mars370d.txt dataset loads without errors. """ - with pytest.warns(expected_warning=FutureWarning) as record: - data = load_mars_shape() - assert len(record) == 1 + data = load_sample_data(name="mars_shape") assert data.shape == (370, 3) assert data["longitude"].min() == 0.008 assert data["longitude"].max() == 359.983 assert data["latitude"].min() == -79.715 assert data["latitude"].max() == 85.887 - assert data["radius(m)"].min() == -6930 - assert data["radius(m)"].max() == 15001 + assert data["radius_m"].min() == -6930 + assert data["radius_m"].max() == 15001 def test_hotspots():