Skip to content

Commit 32ca712

Browse files
Add a sample dataset notre_dame_topography (#1920)
Co-authored-by: Dongdong Tian <[email protected]>
1 parent 427fbdc commit 32ca712

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

pygmt/datasets/samples.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def list_sample_data():
3232
"mars_shape": "Table of topographic signature of the hemispheric dichotomy of "
3333
" Mars from Smith and Zuber (1996)",
3434
"ocean_ridge_points": "Table of ocean ridge points for the entire world",
35+
"notre_dame_topography": "Table 5.11 in Davis: Statistics and Data Analysis in Geology",
3536
"usgs_quakes": "Table of global earthquakes from the USGS",
3637
}
3738
return names
@@ -73,6 +74,7 @@ def load_sample_data(name):
7374
"japan_quakes": load_japan_quakes,
7475
"mars_shape": load_mars_shape,
7576
"ocean_ridge_points": load_ocean_ridge_points,
77+
"notre_dame_topography": _load_notre_dame_topography,
7678
"usgs_quakes": load_usgs_quakes,
7779
}
7880

@@ -348,6 +350,19 @@ def load_mars_shape(**kwargs):
348350
return data
349351

350352

353+
def _load_notre_dame_topography(**kwargs): # pylint: disable=unused-argument
354+
"""
355+
Load Table 5.11 in Davis: Statistics and Data Analysis in Geology.
356+
357+
Returns
358+
-------
359+
data : pandas.DataFrame
360+
The data table with columns "x", "y", and "z".
361+
"""
362+
fname = which("@Table_5_11.txt", download="c")
363+
return pd.read_csv(fname, sep=r"\s+", header=None, names=["x", "y", "z"])
364+
365+
351366
def _load_earth_relief_holes(**kwargs): # pylint: disable=unused-argument
352367
"""
353368
Loads the remote file @earth_relief_20m_holes.grd.

pygmt/tests/test_datasets_samples.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,21 @@ def test_hotspots():
148148
assert isinstance(data, pd.DataFrame)
149149

150150

151+
def test_load_notre_dame_topography():
152+
"""
153+
Check that the @Table_5_11.txt dataset loads without errors.
154+
"""
155+
data = load_sample_data(name="notre_dame_topography")
156+
assert data.shape == (52, 3)
157+
summary = data.describe()
158+
assert summary.loc["min", "x"] == 0.2
159+
assert summary.loc["max", "x"] == 6.3
160+
assert summary.loc["min", "y"] == 0
161+
assert summary.loc["max", "y"] == 6.2
162+
assert summary.loc["min", "z"] == 690
163+
assert summary.loc["max", "z"] == 960
164+
165+
151166
def test_earth_relief_holes():
152167
"""
153168
Check that the @earth_relief_20m_holes.grd dataset loads without errors.

0 commit comments

Comments
 (0)