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.wiggle: Reorder input parameter to 'data, x, y, z' #1548

Merged
merged 8 commits into from
Oct 2, 2021
10 changes: 9 additions & 1 deletion pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from inspect import Parameter, signature

import numpy as np
import pygmt
seisman marked this conversation as resolved.
Show resolved Hide resolved
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers.utils import is_nonstr_iter

Expand Down Expand Up @@ -857,7 +858,14 @@ def new_module(*args, **kwargs):
New module instance that raises a warning if positional arguments
are passed.
"""
if len(args) > 0: # positional arguments are used
# plotting function always has the "self" parameter
if len(args) > 1 and isinstance(args[0], pygmt.Figure):
seisman marked this conversation as resolved.
Show resolved Hide resolved
plotting_func = 1
else:
plotting_func = 0

if len(args) > 1 + plotting_func:
# more than one positional arguments are used
msg = (
"The function parameters has been re-ordered as 'data, x, y, [z]' "
f"since {deprecate_version} but you're passing positional arguments. "
Expand Down
4 changes: 3 additions & 1 deletion pygmt/src/wiggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pygmt.clib import Session
from pygmt.helpers import (
build_arg_string,
check_data_input_order,
deprecate_parameter,
fmt_docstring,
kwargs_to_strings,
Expand All @@ -13,6 +14,7 @@

@fmt_docstring
@deprecate_parameter("columns", "incols", "v0.5.0", remove_version="v0.7.0")
@check_data_input_order("v0.5.0", remove_version="v0.7.0")
@use_alias(
B="frame",
D="position",
Expand All @@ -39,7 +41,7 @@
w="wrap",
)
@kwargs_to_strings(R="sequence", c="sequence_comma", i="sequence_comma", p="sequence")
def wiggle(self, x=None, y=None, z=None, data=None, **kwargs):
def wiggle(self, data=None, x=None, y=None, z=None, **kwargs):
r"""
Plot z=f(x,y) anomalies along tracks.

Expand Down