Skip to content

Commit 91cb50b

Browse files
authored
Add ternary sample dataset
Related to #2138.
1 parent 89916b6 commit 91cb50b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pygmt/datasets/samples.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def list_sample_data():
2424
"""
2525
names = {
2626
"bathymetry": "Table of ship bathymetric observations off Baja California",
27+
"compositions": "Table of rock sample compositions",
2728
"earth_relief_holes": "Regional 20 arc-minute Earth relief grid with holes",
2829
"fractures": "Table of hypothetical fracture lengths and azimuths",
2930
"hotspots": "Table of locations, names, and symbol sizes of hotpots from "
@@ -70,6 +71,7 @@ def load_sample_data(name):
7071
# Dictionary of public load functions for backwards compatibility
7172
load_func_old = {
7273
"bathymetry": load_sample_bathymetry,
74+
"compositions": load_sample_compositions,
7375
"fractures": load_fractures_compilation,
7476
"hotspots": load_hotspots,
7577
"japan_quakes": load_japan_quakes,
@@ -359,6 +361,21 @@ def load_mars_shape(**kwargs):
359361
)
360362
return data
361363

364+
def load_sample_compositions(**kwargs):
365+
"""
366+
Loads the remote file @ternary.txt.
367+
368+
Returns
369+
-------
370+
data : pandas.DataFrame
371+
The data table with columns "a", "b", "c", "z".
372+
"""
373+
374+
fname = which("@ternary.txt", download="c")
375+
data = pd.read_csv(
376+
fname, sep="\t", header=None, names=["a", "b", "c", "z"]
377+
)
378+
return data
362379

363380
def _load_notre_dame_topography():
364381
"""

0 commit comments

Comments
 (0)