Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure.contour/plot/plot3d/rose: Remove parameter "columns", use "incols" instead #1806

Merged
merged 5 commits into from
Mar 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions pygmt/src/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
from pygmt.helpers import (
build_arg_string,
check_data_input_order,
deprecate_parameter,
fmt_docstring,
kwargs_to_strings,
use_alias,
)


@fmt_docstring
@deprecate_parameter("columns", "incols", "v0.4.0", remove_version="v0.6.0")
@check_data_input_order("v0.5.0", remove_version="v0.7.0")
@use_alias(
A="annotation",
Expand Down
1 change: 0 additions & 1 deletion pygmt/src/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

@fmt_docstring
@deprecate_parameter("sizes", "size", "v0.4.0", remove_version="v0.6.0")
@deprecate_parameter("columns", "incols", "v0.4.0", remove_version="v0.6.0")
@check_data_input_order("v0.5.0", remove_version="v0.7.0")
@use_alias(
A="straight_line",
Expand Down
1 change: 0 additions & 1 deletion pygmt/src/plot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


@fmt_docstring
@deprecate_parameter("columns", "incols", "v0.4.0", remove_version="v0.6.0")
@deprecate_parameter("sizes", "size", "v0.4.0", remove_version="v0.6.0")
@check_data_input_order("v0.5.0", remove_version="v0.7.0")
@use_alias(
Expand Down
2 changes: 0 additions & 2 deletions pygmt/src/rose.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
from pygmt.helpers import (
build_arg_string,
check_data_input_order,
deprecate_parameter,
fmt_docstring,
kwargs_to_strings,
use_alias,
)


@fmt_docstring
@deprecate_parameter("columns", "incols", "v0.4.0", remove_version="v0.6.0")
@check_data_input_order("v0.5.0", remove_version="v0.7.0")
@use_alias(
A="sector",
Expand Down
27 changes: 14 additions & 13 deletions pygmt/tests/test_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ def test_contour_from_file(region):


@pytest.mark.mpl_image_compare(filename="test_contour_vec.png")
def test_contour_deprecate_columns_to_incols(region):
def test_contour_incols_transposed_data(region):
"""
Make sure that the old parameter "columns" is supported and it reports an
warning.
Make sure that transposing the data matrix still produces a correct result
with incols reordering the columns.

This is a regression test for
https://github.com/GenericMappingTools/pygmt/issues/1313

Modified from the test_contour_vec() test.
"""
Expand All @@ -96,14 +99,12 @@ def test_contour_deprecate_columns_to_incols(region):
# switch x and y from here onwards to simulate different column order
data = np.array([y, x, z]).T

with pytest.warns(expected_warning=FutureWarning) as record:
fig.contour(
data,
projection="X10c",
region=region,
frame="a",
pen=True,
columns=[1, 0, 2],
)
assert len(record) == 1 # check that only one warning was raised
fig.contour(
data,
projection="X10c",
region=region,
frame="a",
pen=True,
incols=[1, 0, 2],
)
return fig
23 changes: 0 additions & 23 deletions pygmt/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,29 +476,6 @@ def test_plot_deprecate_sizes_to_size(data, region):
return fig


@pytest.mark.mpl_image_compare(filename="test_plot_from_file.png")
def test_plot_deprecate_columns_to_incols(region):
"""
Make sure that the old parameter "columns" is supported and it reports a
warning.

Modified from the test_plot_from_file() test.
"""
fig = Figure()
with pytest.warns(expected_warning=FutureWarning) as record:
fig.plot(
data=POINTS_DATA,
region=region,
projection="X10c",
style="d1c",
color="yellow",
frame=True,
columns=[0, 1],
)
assert len(record) == 1 # check that only one warning was raised
return fig


@pytest.mark.mpl_image_compare
def test_plot_ogrgmt_file_multipoint_default_style():
"""
Expand Down
25 changes: 0 additions & 25 deletions pygmt/tests/test_plot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,31 +450,6 @@ def test_plot3d_deprecate_sizes_to_size(data, region):
return fig


@pytest.mark.mpl_image_compare(filename="test_plot3d_matrix.png")
def test_plot3d_deprecate_columns_to_incols(data, region):
"""
Make sure that the old parameter "columns" is supported and it reports an
warning.

Modified from the test_plot3d_matrix() test.
"""
fig = Figure()
with pytest.warns(expected_warning=FutureWarning) as record:
fig.plot3d(
data,
zscale=5,
perspective=[225, 30],
region=region,
projection="M20c",
style="c1c",
color="#aaaaaa",
frame=["a", "za"],
columns="0,1,2",
)
assert len(record) == 1 # check that only one warning was raised
return fig


@pytest.mark.mpl_image_compare
def test_plot3d_ogrgmt_file_multipoint_default_style():
"""
Expand Down
34 changes: 0 additions & 34 deletions pygmt/tests/test_rose.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,37 +184,3 @@ def test_rose_bools(data_fractures_compilation):
shift=False,
)
return fig


@pytest.mark.mpl_image_compare(filename="test_rose_bools.png")
def test_rose_deprecate_columns_to_incols(data_fractures_compilation):
"""
Make sure that the old parameter "columns" is supported and it reports a
warning.

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,
region=[0, 1, 0, 360],
sector=10,
columns=[1, 0],
diameter="10c",
frame=["x0.2g0.2", "y30g30", "+glightgray"],
color="red3",
pen="1p",
orientation=False,
norm=True,
vectors=True,
no_scale=True,
shift=False,
)
assert len(record) == 1 # check that only one warning was raised
return fig