Skip to content

Commit 0cb0f77

Browse files
authored
Figure.contour/plot/plot3d/rose: Remove parameter "columns", use "incols" instead (#1806)
* Figure.contour: Remove parameter "columns", use "incols" instead * Figure.plot: Remove parameter "columns", use "incols" instead * Figure.plot3d: Remove parameter "columns", use "incols" instead * Remove unused deprecate_parameter function * Figure.rose: Remove parameter "columns", use "incols" instead
1 parent 5734902 commit 0cb0f77

File tree

8 files changed

+14
-101
lines changed

8 files changed

+14
-101
lines changed

pygmt/src/contour.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
from pygmt.helpers import (
77
build_arg_string,
88
check_data_input_order,
9-
deprecate_parameter,
109
fmt_docstring,
1110
kwargs_to_strings,
1211
use_alias,
1312
)
1413

1514

1615
@fmt_docstring
17-
@deprecate_parameter("columns", "incols", "v0.4.0", remove_version="v0.6.0")
1816
@check_data_input_order("v0.5.0", remove_version="v0.7.0")
1917
@use_alias(
2018
A="annotation",

pygmt/src/plot.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
@fmt_docstring
2020
@deprecate_parameter("sizes", "size", "v0.4.0", remove_version="v0.6.0")
21-
@deprecate_parameter("columns", "incols", "v0.4.0", remove_version="v0.6.0")
2221
@check_data_input_order("v0.5.0", remove_version="v0.7.0")
2322
@use_alias(
2423
A="straight_line",

pygmt/src/plot3d.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818

1919
@fmt_docstring
20-
@deprecate_parameter("columns", "incols", "v0.4.0", remove_version="v0.6.0")
2120
@deprecate_parameter("sizes", "size", "v0.4.0", remove_version="v0.6.0")
2221
@check_data_input_order("v0.5.0", remove_version="v0.7.0")
2322
@use_alias(

pygmt/src/rose.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
from pygmt.helpers import (
77
build_arg_string,
88
check_data_input_order,
9-
deprecate_parameter,
109
fmt_docstring,
1110
kwargs_to_strings,
1211
use_alias,
1312
)
1413

1514

1615
@fmt_docstring
17-
@deprecate_parameter("columns", "incols", "v0.4.0", remove_version="v0.6.0")
1816
@check_data_input_order("v0.5.0", remove_version="v0.7.0")
1917
@use_alias(
2018
A="sector",

pygmt/tests/test_contour.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,13 @@ def test_contour_from_file(region):
7676

7777

7878
@pytest.mark.mpl_image_compare(filename="test_contour_vec.png")
79-
def test_contour_deprecate_columns_to_incols(region):
79+
def test_contour_incols_transposed_data(region):
8080
"""
81-
Make sure that the old parameter "columns" is supported and it reports an
82-
warning.
81+
Make sure that transposing the data matrix still produces a correct result
82+
with incols reordering the columns.
83+
84+
This is a regression test for
85+
https://github.com/GenericMappingTools/pygmt/issues/1313
8386
8487
Modified from the test_contour_vec() test.
8588
"""
@@ -96,14 +99,12 @@ def test_contour_deprecate_columns_to_incols(region):
9699
# switch x and y from here onwards to simulate different column order
97100
data = np.array([y, x, z]).T
98101

99-
with pytest.warns(expected_warning=FutureWarning) as record:
100-
fig.contour(
101-
data,
102-
projection="X10c",
103-
region=region,
104-
frame="a",
105-
pen=True,
106-
columns=[1, 0, 2],
107-
)
108-
assert len(record) == 1 # check that only one warning was raised
102+
fig.contour(
103+
data,
104+
projection="X10c",
105+
region=region,
106+
frame="a",
107+
pen=True,
108+
incols=[1, 0, 2],
109+
)
109110
return fig

pygmt/tests/test_plot.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -476,29 +476,6 @@ def test_plot_deprecate_sizes_to_size(data, region):
476476
return fig
477477

478478

479-
@pytest.mark.mpl_image_compare(filename="test_plot_from_file.png")
480-
def test_plot_deprecate_columns_to_incols(region):
481-
"""
482-
Make sure that the old parameter "columns" is supported and it reports a
483-
warning.
484-
485-
Modified from the test_plot_from_file() test.
486-
"""
487-
fig = Figure()
488-
with pytest.warns(expected_warning=FutureWarning) as record:
489-
fig.plot(
490-
data=POINTS_DATA,
491-
region=region,
492-
projection="X10c",
493-
style="d1c",
494-
color="yellow",
495-
frame=True,
496-
columns=[0, 1],
497-
)
498-
assert len(record) == 1 # check that only one warning was raised
499-
return fig
500-
501-
502479
@pytest.mark.mpl_image_compare
503480
def test_plot_ogrgmt_file_multipoint_default_style():
504481
"""

pygmt/tests/test_plot3d.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -450,31 +450,6 @@ def test_plot3d_deprecate_sizes_to_size(data, region):
450450
return fig
451451

452452

453-
@pytest.mark.mpl_image_compare(filename="test_plot3d_matrix.png")
454-
def test_plot3d_deprecate_columns_to_incols(data, region):
455-
"""
456-
Make sure that the old parameter "columns" is supported and it reports an
457-
warning.
458-
459-
Modified from the test_plot3d_matrix() test.
460-
"""
461-
fig = Figure()
462-
with pytest.warns(expected_warning=FutureWarning) as record:
463-
fig.plot3d(
464-
data,
465-
zscale=5,
466-
perspective=[225, 30],
467-
region=region,
468-
projection="M20c",
469-
style="c1c",
470-
color="#aaaaaa",
471-
frame=["a", "za"],
472-
columns="0,1,2",
473-
)
474-
assert len(record) == 1 # check that only one warning was raised
475-
return fig
476-
477-
478453
@pytest.mark.mpl_image_compare
479454
def test_plot3d_ogrgmt_file_multipoint_default_style():
480455
"""

pygmt/tests/test_rose.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -184,37 +184,3 @@ def test_rose_bools(data_fractures_compilation):
184184
shift=False,
185185
)
186186
return fig
187-
188-
189-
@pytest.mark.mpl_image_compare(filename="test_rose_bools.png")
190-
def test_rose_deprecate_columns_to_incols(data_fractures_compilation):
191-
"""
192-
Make sure that the old parameter "columns" is supported and it reports a
193-
warning.
194-
195-
Modified from the test_rose_bools() test.
196-
"""
197-
198-
# swap data column order of the sample fractures compilation dataset,
199-
# as the use of the 'columns' parameter will reverse this action
200-
data = data_fractures_compilation[["azimuth", "length"]]
201-
202-
fig = Figure()
203-
with pytest.warns(expected_warning=FutureWarning) as record:
204-
fig.rose(
205-
data,
206-
region=[0, 1, 0, 360],
207-
sector=10,
208-
columns=[1, 0],
209-
diameter="10c",
210-
frame=["x0.2g0.2", "y30g30", "+glightgray"],
211-
color="red3",
212-
pen="1p",
213-
orientation=False,
214-
norm=True,
215-
vectors=True,
216-
no_scale=True,
217-
shift=False,
218-
)
219-
assert len(record) == 1 # check that only one warning was raised
220-
return fig

0 commit comments

Comments
 (0)