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_mars_shape function (deprecated since v0.6.0) #2304

Merged
merged 13 commits into from
Jan 31, 2023
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_fractures_compilation
datasets.load_hotspots
datasets.load_japan_quakes
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 @@ -15,7 +15,6 @@
load_fractures_compilation,
load_hotspots,
load_japan_quakes,
load_mars_shape,
load_ocean_ridge_points,
load_sample_bathymetry,
load_sample_data,
Expand Down
28 changes: 3 additions & 25 deletions pygmt/datasets/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def load_sample_data(name):
"fractures": load_fractures_compilation,
"hotspots": load_hotspots,
"japan_quakes": load_japan_quakes,
"mars_shape": load_mars_shape,
"ocean_ridge_points": load_ocean_ridge_points,
"usgs_quakes": load_usgs_quakes,
}
Expand All @@ -83,6 +82,7 @@ def load_sample_data(name):
load_func = {
"rock_compositions": _load_rock_sample_compositions,
"earth_relief_holes": _load_earth_relief_holes,
"mars_shape": _load_mars_shape,
"maunaloa_co2": _load_maunaloa_co2,
"notre_dame_topography": _load_notre_dame_topography,
}
Expand Down Expand Up @@ -324,37 +324,15 @@ def load_hotspots(**kwargs):
return data


def load_mars_shape(**kwargs):
def _load_mars_shape():
"""
(Deprecated) Load a table of data for the shape of Mars.

.. 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)."
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 data for the shape of Mars as a pandas.DataFrame.
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved

Returns
-------
data : pandas.DataFrame
The data table with columns "longitude", "latitude", and "radius(m)".
willschlitzer marked this conversation as resolved.
Show resolved Hide 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='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)"]
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_fractures_compilation,
load_hotspots,
load_japan_quakes,
load_mars_shape,
load_ocean_ridge_points,
load_sample_bathymetry,
load_sample_data,
Expand Down Expand Up @@ -113,9 +112,7 @@ 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
Expand Down