From b9700af38bf8458c2accb461ec195587ad5b145c Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 7 Jun 2021 08:19:43 +0200 Subject: [PATCH 1/7] Update test_rose.py --- pygmt/tests/test_rose.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pygmt/tests/test_rose.py b/pygmt/tests/test_rose.py index 45e3f6092cd..bc533fe0888 100644 --- a/pygmt/tests/test_rose.py +++ b/pygmt/tests/test_rose.py @@ -38,7 +38,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, @@ -129,7 +128,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, @@ -151,7 +149,6 @@ def test_rose_no_sectors(data_fractures_compilation): 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'"], @@ -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", @@ -204,7 +200,6 @@ def test_rose_deprecate_columns_to_incols(data_fractures_compilation): data=data_fractures_compilation, region=[0, 1, 0, 360], sector=10, - columns=[1, 0], diameter="10c", frame=["x0.2g0.2", "y30g30", "+glightgray"], color="red3", From de75fd562552dd745fe56c07c81216bd92bb69db Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Mon, 7 Jun 2021 08:47:20 +0200 Subject: [PATCH 2/7] update --- pygmt/tests/test_rose.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pygmt/tests/test_rose.py b/pygmt/tests/test_rose.py index bc533fe0888..886d7e96969 100644 --- a/pygmt/tests/test_rose.py +++ b/pygmt/tests/test_rose.py @@ -194,12 +194,18 @@ def test_rose_deprecate_columns_to_incols(data_fractures_compilation): Modified from the test_rose_bools() test. """ + + data = data_fractures_compilation + # swap data columns + data[:, [0, 1]] = data[:, [1, 0]] + 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], diameter="10c", frame=["x0.2g0.2", "y30g30", "+glightgray"], color="red3", From d803f06abda9c2d6d65522332fd31cae458f8943 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Mon, 7 Jun 2021 18:01:21 +0200 Subject: [PATCH 3/7] update --- pygmt/tests/test_rose.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/tests/test_rose.py b/pygmt/tests/test_rose.py index 886d7e96969..e8206646562 100644 --- a/pygmt/tests/test_rose.py +++ b/pygmt/tests/test_rose.py @@ -197,7 +197,7 @@ def test_rose_deprecate_columns_to_incols(data_fractures_compilation): data = data_fractures_compilation # swap data columns - data[:, [0, 1]] = data[:, [1, 0]] + data = data[["azimuth", "length"]] fig = Figure() with pytest.warns(expected_warning=FutureWarning) as record: From 5583182bddd02a685811b0b32cca3beaa019b242 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Mon, 7 Jun 2021 18:07:03 +0200 Subject: [PATCH 4/7] some formatting --- pygmt/tests/test_rose.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pygmt/tests/test_rose.py b/pygmt/tests/test_rose.py index e8206646562..37718d72ff9 100644 --- a/pygmt/tests/test_rose.py +++ b/pygmt/tests/test_rose.py @@ -21,6 +21,8 @@ def fixture_data(): def fixture_data_fractures_compilation(): """ Load the sample fractures compilation dataset. + + Lengths are stored in the first column, azimuths in the second. """ return load_fractures_compilation() @@ -115,8 +117,7 @@ def test_rose_plot_data_using_cpt(data): 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). + azimuths as digitized from geological maps to the data argument. Use transparency. """ @@ -140,8 +141,7 @@ def test_rose_plot_with_transparency(data_fractures_compilation): 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). + azimuth as digitized from geological maps to the data argument. Plot data without defining a sector width, add a title and rename labels. """ @@ -163,8 +163,7 @@ def test_rose_no_sectors(data_fractures_compilation): 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). + azimuth as digitized from geological maps to the data argument. Test bools. """ @@ -196,7 +195,8 @@ def test_rose_deprecate_columns_to_incols(data_fractures_compilation): """ data = data_fractures_compilation - # swap data columns + # swap data columns, below the use of the columns parameter + # reverses this action data = data[["azimuth", "length"]] fig = Figure() From d27148da1244a73d08c036e102d5e95568793f41 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Tue, 8 Jun 2021 08:09:11 +0200 Subject: [PATCH 5/7] Update pygmt/tests/test_rose.py Co-authored-by: Dongdong Tian --- pygmt/tests/test_rose.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pygmt/tests/test_rose.py b/pygmt/tests/test_rose.py index 37718d72ff9..e763a793b4c 100644 --- a/pygmt/tests/test_rose.py +++ b/pygmt/tests/test_rose.py @@ -194,10 +194,9 @@ def test_rose_deprecate_columns_to_incols(data_fractures_compilation): Modified from the test_rose_bools() test. """ - data = data_fractures_compilation # swap data columns, below the use of the columns parameter # reverses this action - data = data[["azimuth", "length"]] + data = data_fractures_compilation[["azimuth", "length"]] fig = Figure() with pytest.warns(expected_warning=FutureWarning) as record: From 60124af9b5fbb3ae96cf9af2d88251a094ca0719 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Tue, 8 Jun 2021 08:17:01 +0200 Subject: [PATCH 6/7] some formatting --- pygmt/tests/test_rose.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pygmt/tests/test_rose.py b/pygmt/tests/test_rose.py index e763a793b4c..9633e8ce5e5 100644 --- a/pygmt/tests/test_rose.py +++ b/pygmt/tests/test_rose.py @@ -20,7 +20,8 @@ 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. """ @@ -116,8 +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 - azimuths as digitized from geological maps to the data argument. + Test supplying the sample fractures compilation dataset to the data + argument. Use transparency. """ @@ -140,8 +141,8 @@ 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. + Test supplying the sample fractures compilation dataset to the data + argument. Plot data without defining a sector width, add a title and rename labels. """ @@ -162,8 +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. + Test supplying the sample fractures compilation dataset to the data + argument. Test bools. """ @@ -194,8 +195,8 @@ def test_rose_deprecate_columns_to_incols(data_fractures_compilation): Modified from the test_rose_bools() test. """ - # swap data columns, below the use of the columns parameter - # reverses this action + # swap data columns of the sample fractures compilation dataset, below the + # use of the columns parameter reverses this action data = data_fractures_compilation[["azimuth", "length"]] fig = Figure() From 912dabb4efab074fab7d3613a6775c4c2d6876a0 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 9 Jun 2021 07:58:24 +0200 Subject: [PATCH 7/7] Apply suggestions from code review Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- pygmt/tests/test_rose.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pygmt/tests/test_rose.py b/pygmt/tests/test_rose.py index 9633e8ce5e5..4460c5f6473 100644 --- a/pygmt/tests/test_rose.py +++ b/pygmt/tests/test_rose.py @@ -118,7 +118,7 @@ def test_rose_plot_data_using_cpt(data): def test_rose_plot_with_transparency(data_fractures_compilation): """ Test supplying the sample fractures compilation dataset to the data - argument. + parameter. Use transparency. """ @@ -142,7 +142,7 @@ def test_rose_plot_with_transparency(data_fractures_compilation): def test_rose_no_sectors(data_fractures_compilation): """ Test supplying the sample fractures compilation dataset to the data - argument. + parameter. Plot data without defining a sector width, add a title and rename labels. """ @@ -164,7 +164,7 @@ def test_rose_no_sectors(data_fractures_compilation): def test_rose_bools(data_fractures_compilation): """ Test supplying the sample fractures compilation dataset to the data - argument. + parameter. Test bools. """ @@ -195,8 +195,8 @@ def test_rose_deprecate_columns_to_incols(data_fractures_compilation): Modified from the test_rose_bools() test. """ - # swap data columns of the sample fractures compilation dataset, below the - # use of the columns parameter reverses this action + # 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()