Skip to content

Commit

Permalink
Add usage of z value in ternary dataset (GenericMappingTools#2227)
Browse files Browse the repository at this point in the history
Co-authored-by: Yvonne Fröhlich <[email protected]>
  • Loading branch information
2 people authored and Josh Sixsmith committed Dec 21, 2022
1 parent dd7f40b commit 17a3404
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pygmt/datasets/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,16 @@ def _load_rock_sample_compositions():
Returns
-------
data : pandas.DataFrame
The data table with columns "water", "air", and "limestone".
The data table with columns "limestone", "water", "air",
and "permittivity".
"""

fname = which("@ternary.txt", download="c")
return pd.read_csv(
fname,
delim_whitespace=True,
header=None,
names=["water", "air", "limestone"],
usecols=(0, 1, 2),
names=["limestone", "water", "air", "permittivity"],
)


Expand Down
12 changes: 7 additions & 5 deletions pygmt/tests/test_datasets_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,12 @@ def test_rock_sample_compositions():
Check that the @ternary.txt dataset loads without errors.
"""
data = load_sample_data(name="rock_compositions")
assert data.shape == (1000, 3)
assert data.shape == (1000, 4)
assert data["limestone"].min() == 0
assert data["limestone"].max() == 1
assert data["water"].min() == 0
assert data["water"].max() == 1
assert data["water"].max() == 0.921
assert data["air"].min() == 0
assert data["air"].max() == 0.921
assert data["limestone"].min() == 0
assert data["limestone"].max() == 0.981
assert data["air"].max() == 0.981
assert data["permittivity"].min() == 1.041
assert data["permittivity"].max() == 70.844

0 comments on commit 17a3404

Please sign in to comment.