Skip to content

Commit

Permalink
Fix rose tests for GMT 6.2.0 (GenericMappingTools#1324)
Browse files Browse the repository at this point in the history
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
  • Loading branch information
3 people authored and Josh Sixsmith committed Dec 21, 2022
1 parent 3c67370 commit bb4196b
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions pygmt/tests/test_rose.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ def fixture_data():
@pytest.fixture(scope="module", name="data_fractures_compilation")
def fixture_data_fractures_compilation():
"""
Load the sample fractures compilation dataset.
Load the sample fractures compilation dataset which contains fracture
lengths and azimuths as hypothetically digitized from geological maps.
Lengths are stored in the first column, azimuths in the second.
"""
return load_fractures_compilation()

Expand All @@ -38,7 +41,6 @@ def test_rose_data_file(data_fractures_compilation):
diameter="5.5c",
color="blue",
frame=["x0.2g0.2", "y30g30", "+glightgray"],
incols=[1, 0],
pen="1p",
norm="",
scale=0.4,
Expand Down Expand Up @@ -115,9 +117,8 @@ def test_rose_plot_data_using_cpt(data):
@pytest.mark.mpl_image_compare
def test_rose_plot_with_transparency(data_fractures_compilation):
"""
Test supplying a data file containing a list of fracture lengths and
azimuth as digitized from geological maps to the data argument (lengths are
stored in the second column, azimuths in the first, specify via columns).
Test supplying the sample fractures compilation dataset to the data
parameter.
Use transparency.
"""
Expand All @@ -129,7 +130,6 @@ def test_rose_plot_with_transparency(data_fractures_compilation):
diameter="5.5c",
color="blue",
frame=["x0.2g0.2", "y30g30", "+glightgray"],
incols=[1, 0],
pen="1p",
norm=True,
scale=0.4,
Expand All @@ -141,17 +141,15 @@ def test_rose_plot_with_transparency(data_fractures_compilation):
@pytest.mark.mpl_image_compare
def test_rose_no_sectors(data_fractures_compilation):
"""
Test supplying a data file containing a list of fracture lengths and
azimuth as digitized from geological maps to the data argument (lengths are
stored in the second column, azimuths in the first, specify via columns).
Test supplying the sample fractures compilation dataset to the data
parameter.
Plot data without defining a sector width, add a title and rename labels.
"""
fig = Figure()
fig.rose(
data=data_fractures_compilation,
region=[0, 500, 0, 360],
incols="1,0",
diameter="10c",
labels="180/0/90/270",
frame=["xg100", "yg45", "+t'Windrose diagram'"],
Expand All @@ -165,9 +163,8 @@ def test_rose_no_sectors(data_fractures_compilation):
@pytest.mark.mpl_image_compare
def test_rose_bools(data_fractures_compilation):
"""
Test supplying a data file containing a list of fracture lengths and
azimuth as digitized from geological maps to the data argument (lengths are
stored in the second column, azimuths in the first, specify via columns).
Test supplying the sample fractures compilation dataset to the data
parameter.
Test bools.
"""
Expand All @@ -176,7 +173,6 @@ def test_rose_bools(data_fractures_compilation):
data=data_fractures_compilation,
region=[0, 1, 0, 360],
sector=10,
incols=[1, 0],
diameter="10c",
frame=["x0.2g0.2", "y30g30", "+glightgray"],
color="red3",
Expand All @@ -198,10 +194,15 @@ def test_rose_deprecate_columns_to_incols(data_fractures_compilation):
Modified from the test_rose_bools() test.
"""

# swap data column order of the sample fractures compilation dataset,
# as the use of the 'columns' parameter will reverse this action
data = data_fractures_compilation[["azimuth", "length"]]

fig = Figure()
with pytest.warns(expected_warning=FutureWarning) as record:
fig.rose(
data=data_fractures_compilation,
data=data,
region=[0, 1, 0, 360],
sector=10,
columns=[1, 0],
Expand Down

0 comments on commit bb4196b

Please sign in to comment.