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

Merged
merged 15 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from 8 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 @@ -235,7 +235,6 @@ Use :func:`pygmt.datasets.load_sample_data` instead.
.. autosummary::
:toctree: generated

datasets.load_fractures_compilation
datasets.load_hotspots
datasets.load_japan_quakes
datasets.load_mars_shape
Expand Down
1 change: 0 additions & 1 deletion pygmt/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
)
from pygmt.datasets.samples import (
list_sample_data,
load_fractures_compilation,
load_hotspots,
load_japan_quakes,
load_mars_shape,
Expand Down
28 changes: 5 additions & 23 deletions pygmt/datasets/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def load_sample_data(name):
# Dictionary of public load functions for backwards compatibility
load_func_old = {
"bathymetry": load_sample_bathymetry,
"fractures": load_fractures_compilation,
"hotspots": load_hotspots,
"japan_quakes": load_japan_quakes,
"mars_shape": load_mars_shape,
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,
"fractures": _load_fractures_compilation,
"maunaloa_co2": _load_maunaloa_co2,
"notre_dame_topography": _load_notre_dame_topography,
}
Expand Down Expand Up @@ -250,20 +250,10 @@ def load_usgs_quakes(**kwargs):
return data


def load_fractures_compilation(**kwargs):
def _load_fractures_compilation():
"""
(Deprecated) Load a table of fracture lengths and azimuths as
hypothetically digitized from geological maps as a pandas.DataFrame.

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

This is the ``@fractures_06.txt`` 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 fracture lengths and azimuths as hypothetically digitized
from geological maps as a pandas.DataFrame.
yvonnefroehlich marked this conversation as resolved.
Show resolved Hide resolved

Returns
-------
Expand All @@ -272,16 +262,8 @@ def load_fractures_compilation(**kwargs):
columns.
michaelgrund 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='fractures') instead.",
category=FutureWarning,
stacklevel=2,
)
fname = which("@fractures_06.txt", download="c")
data = pd.read_csv(fname, header=None, sep=r"\s+", names=["azimuth", "length"])
data = pd.read_csv(fname, header=None, delim_whitespace=True, names=["azimuth", "length"])
return data[["length", "azimuth"]]


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 @@ -5,7 +5,6 @@
import pandas as pd
import pytest
from pygmt.datasets import (
load_fractures_compilation,
load_hotspots,
load_japan_quakes,
load_mars_shape,
Expand Down Expand Up @@ -99,9 +98,7 @@ def test_fractures_compilation():
"""
Check that the @fractures_06.txt dataset loads without errors.
"""
with pytest.warns(expected_warning=FutureWarning) as record:
data = load_fractures_compilation()
assert len(record) == 1
data = load_sample_data(name="fractures")
assert data.shape == (361, 2)
assert data["length"].min() == 98.6561
assert data["length"].max() == 984.652
Expand Down