diff --git a/doc/api/index.rst b/doc/api/index.rst index 618e95b6786..51abb721018 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -237,7 +237,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 diff --git a/pygmt/datasets/__init__.py b/pygmt/datasets/__init__.py index 87595e0b6bc..0ee95a42b31 100644 --- a/pygmt/datasets/__init__.py +++ b/pygmt/datasets/__init__.py @@ -14,7 +14,6 @@ list_sample_data, load_fractures_compilation, load_hotspots, - load_japan_quakes, load_mars_shape, load_ocean_ridge_points, load_sample_bathymetry, diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index 52cc349a1c8..52013c0ee8a 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -73,7 +73,6 @@ def load_sample_data(name): "bathymetry": load_sample_bathymetry, "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, @@ -81,10 +80,11 @@ def load_sample_data(name): # Dictionary of private load functions load_func = { - "rock_compositions": _load_rock_sample_compositions, "earth_relief_holes": _load_earth_relief_holes, + "japan_quakes": _load_japan_quakes, "maunaloa_co2": _load_maunaloa_co2, "notre_dame_topography": _load_notre_dame_topography, + "rock_compositions": _load_rock_sample_compositions, } if name in load_func_old: @@ -95,51 +95,34 @@ def load_sample_data(name): return data -def load_japan_quakes(**kwargs): +def _load_japan_quakes(): """ - (Deprecated) Load a table of earthquakes around Japan as a - pandas.DataFrame. + Load a table of earthquakes around Japan as a pandas.DataFrame. - .. warning:: Deprecated since v0.6.0. This function has been replaced with - ``load_sample_data(name="japan_quakes")`` and will be removed in - v0.9.0. - - Data is from the NOAA NGDC database. This is the ``@tut_quakes.ngdc`` - 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. + Data is from the NOAA NGDC database. Returns ------- data : pandas.DataFrame - The data table. Columns are year, month, day, latitude, longitude, - depth (in km), and magnitude of the earthquakes. + The data table. The column names are "year", "month", "day", + "latitude", "longitude", "depth_km", and "magnitude" of the + earthquakes. """ - - 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='japan_quakes') instead.", - category=FutureWarning, - stacklevel=2, - ) - fname = which("@tut_quakes.ngdc", download="c") - data = pd.read_csv(fname, header=1, sep=r"\s+") - data.columns = [ - "year", - "month", - "day", - "latitude", - "longitude", - "depth_km", - "magnitude", - ] - - return data + return pd.read_csv( + fname, + header=1, + delim_whitespace=True, + names=[ + "year", + "month", + "day", + "latitude", + "longitude", + "depth_km", + "magnitude", + ], + ) def load_ocean_ridge_points(**kwargs): diff --git a/pygmt/tests/test_datasets_samples.py b/pygmt/tests/test_datasets_samples.py index 8fa1d8153ba..d96c7d9729e 100644 --- a/pygmt/tests/test_datasets_samples.py +++ b/pygmt/tests/test_datasets_samples.py @@ -7,7 +7,6 @@ from pygmt.datasets import ( load_fractures_compilation, load_hotspots, - load_japan_quakes, load_mars_shape, load_ocean_ridge_points, load_sample_bathymetry, @@ -26,22 +25,6 @@ def test_load_sample_invalid(): def test_japan_quakes(): - """ - Check that the dataset loads without errors. - """ - with pytest.warns(expected_warning=FutureWarning) as record: - data = load_japan_quakes() - assert len(record) == 1 - assert data.shape == (115, 7) - assert data["year"].min() == 1987 - assert data["year"].max() == 1988 - assert data["month"].min() == 1 - assert data["month"].max() == 12 - assert data["day"].min() == 1 - assert data["day"].max() == 31 - - -def test_load_sample_data(): """ Check that the dataset loads without errors. """