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.grdcontour: Remove the deprecated syntax for the 'annotation' parameter #3428

Merged
merged 1 commit into from
Sep 9, 2024
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
16 changes: 0 additions & 16 deletions pygmt/src/grdcontour.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
grdcontour - Plot a contour figure.
"""

import warnings

from pygmt.clib import Session
from pygmt.helpers import (
build_arg_list,
Expand Down Expand Up @@ -140,20 +138,6 @@ def grdcontour(self, grid, **kwargs):
"""
kwargs = self._preprocess(**kwargs)

# Backward compatibility with the old syntax for the annotation parameter, e.g.,
# [100, "e", "f10p", "gred"].
if is_nonstr_iter(kwargs.get("A")) and any(
i[0] in "acdefgijlLnoprtuvwx=" for i in kwargs["A"] if isinstance(i, str)
):
msg = (
"Argument of the parameter 'annotation'/'A' is using the old, deprecated "
"syntax. Please refer to the PyGMT documentation for the new syntax. "
"The warning will be removed in v0.14.0 and the old syntax will no longer "
"be supported. "
)
warnings.warn(msg, category=FutureWarning, stacklevel=2)
kwargs["A"] = "+".join(f"{item}" for item in kwargs["A"])

# Specify levels for the annotation and levels parameters.
# One level is converted to a string with a trailing comma to separate it from
# specifying an interval.
Expand Down
17 changes: 0 additions & 17 deletions pygmt/tests/test_grdcontour.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,6 @@ def test_grdcontour_one_level(grid):
return fig


@pytest.mark.mpl_image_compare(filename="test_grdcontour_one_level.png")
def test_grdcontour_old_annotations(grid):
"""
Test the old syntax for the annotation parameter using "sequence_plus".
Modified from the "test_grdcontour_one_level()" test. Can be removed in v0.14.0.
"""
fig = Figure()
fig.grdcontour(
grid=grid,
levels=[400],
annotation=["570,", "gwhite"],
projection="M10c",
frame=True,
)
return fig


@pytest.mark.mpl_image_compare
def test_grdcontour_multiple_levels(grid):
"""
Expand Down