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

Add a sample dataset notre_dame_topography #1920

Merged
merged 8 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from 6 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
16 changes: 16 additions & 0 deletions pygmt/datasets/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def list_sample_data():
"mars_shape": "Table of topographic signature of the hemispheric dichotomy of "
" Mars from Smith and Zuber (1996)",
"ocean_ridge_points": "Table of ocean ridge points for the entire world",
"notre_dame_topography": "Table 5.11 in Davis: Statistics and Data Analysis in Geology.",
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
"usgs_quakes": "Table of global earthquakes from the USGS",
}
return names
Expand Down Expand Up @@ -73,6 +74,7 @@ def load_sample_data(name):
"japan_quakes": load_japan_quakes,
"mars_shape": load_mars_shape,
"ocean_ridge_points": load_ocean_ridge_points,
"notre_dame_topography": _load_notre_dame_topography,
"usgs_quakes": load_usgs_quakes,
}

Expand Down Expand Up @@ -348,6 +350,20 @@ def load_mars_shape(**kwargs):
return data


def _load_notre_dame_topography(**kwargs):
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
"""
Load Table 5.11 (Table_5_11.txt) in Davis: Statistics and Data Analysis in
Geology.
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved

Returns
-------
data : pandas.DataFrame
The data table with columns "x", "y", and "z".
"""
fname = which("@Table_5_11.txt", download="c")
return pd.read_csv(fname, sep=r"\s+", header=None, names=["x", "y", "z"])


def _load_earth_relief_holes(**kwargs): # pylint: disable=unused-argument
"""
Loads the remote file @earth_relief_20m_holes.grd.
Expand Down
15 changes: 15 additions & 0 deletions pygmt/tests/test_datasets_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,21 @@ def test_hotspots():
assert isinstance(data, pd.DataFrame)


def test_load_notre_dame_topography():
"""
Check that the @table_5_11.txt dataset loads without errors.
willschlitzer marked this conversation as resolved.
Show resolved Hide resolved
"""
data = load_sample_data(name="notre_dame_topography")
assert data.shape == (52, 3)
summary = data.describe()
assert summary.loc["min", "x"] == 0.2
assert summary.loc["max", "x"] == 6.3
assert summary.loc["min", "y"] == 0
assert summary.loc["max", "y"] == 6.2
assert summary.loc["min", "z"] == 690
assert summary.loc["max", "z"] == 960


def test_earth_relief_holes():
"""
Check that the @earth_relief_20m_holes.grd dataset loads without errors.
Expand Down