-
Notifications
You must be signed in to change notification settings - Fork 224
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_japan_quakes function (deprecated since v0.6.0) #2301
Changes from 4 commits
a103de9
a35adc6
d653007
d9611df
92bcec3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -73,18 +73,18 @@ 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, | ||||||||||||
} | ||||||||||||
|
||||||||||||
# 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,32 @@ 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. | ||||||||||||
|
||||||||||||
.. 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. | ||||||||||||
Load a table of earthquakes around Japan as a pandas.DataFrame. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yvonnefroehlich Thanks for your comments.
I've added this sentence back in 92bcec3.
I don't think this sentence would provide any meaningful information. The file name is easy to get from the function and we all know that these dataset are used in the tutorials. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's discuss it in this PR and then update other PRs if necessary. @michaelgrund and @willschlitzer what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm with @seisman since this information is not really required at this point in my opinion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, then we can merge this PR.
seisman marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
|
||||||||||||
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", | ||||||||||||
], | ||||||||||||
) | ||||||||||||
Comment on lines
+112
to
+125
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI, I also made two changes when reading the dataset:
|
||||||||||||
|
||||||||||||
|
||||||||||||
def load_ocean_ridge_points(**kwargs): | ||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right. I removed in a35adc6. |
||
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. | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should keep this background information of the data?