Skip to content

Commit cc13f00

Browse files
committed
Remove the deprecated 'mode' parameter from aliases
1 parent 385470d commit cc13f00

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pygmt/src/grdfill.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ def _parse_fill_mode(
6767

6868
@fmt_docstring
6969
# TODO(PyGMT>=0.19.0): Remove the deprecated 'no_data' parameter.
70+
# TODO(PyGMT>=0.19.0): Remove the deprecated 'mode' parameter.
7071
@deprecate_parameter("no_data", "hole", "v0.15.0", remove_version="v0.19.0")
71-
@use_alias(A="mode", N="hole", R="region", V="verbose", f="coltypes")
72+
@use_alias(N="hole", R="region", V="verbose", f="coltypes")
7273
@kwargs_to_strings(R="sequence")
7374
def grdfill(
7475
grid: str | xr.DataArray,
@@ -78,6 +79,7 @@ def grdfill(
7879
neighborfill: float | bool | None = None,
7980
splinefill: float | bool | None = None,
8081
inquire: bool = False,
82+
mode: str | None = None,
8183
**kwargs,
8284
) -> xr.DataArray | np.ndarray | None:
8385
r"""
@@ -117,7 +119,7 @@ def grdfill(
117119
Output the bounds of each hole. The bounds are returned as a 2-D numpy array in
118120
the form of (west, east, south, north). No grid fill takes place and ``outgrid``
119121
is ignored.
120-
mode : str
122+
mode
121123
Specify the hole-filling algorithm to use. Choose from **c** for constant fill
122124
and append the constant value, **n** for nearest neighbor (and optionally append
123125
a search radius in pixels [default radius is :math:`r^2 = \sqrt{{ X^2 + Y^2 }}`,
@@ -155,17 +157,16 @@ def grdfill(
155157
array([[1.83333333, 6.16666667, 3.83333333, 8.16666667],
156158
[6.16666667, 7.83333333, 0.5 , 2.5 ]])
157159
"""
158-
# TODO(PyGMT>=0.19.0): Remove the deprecated 'mode' parameter.
159-
if kwargs.get("A") is not None: # The deprecated 'mode' parameter is given.
160+
if mode is not None: # The deprecated 'mode' parameter is given.
160161
warnings.warn(
161162
"The 'mode' parameter is deprecated since v0.15.0 and will be removed in "
162163
"v0.19.0. Use 'constantfill'/'gridfill'/'neighborfill'/'splinefill' "
163164
"instead.",
164165
FutureWarning,
165166
stacklevel=1,
166167
)
168+
kwargs["A"] = mode
167169
else:
168-
# Determine the -A option from the fill parameters.
169170
kwargs["A"] = _parse_fill_mode(constantfill, gridfill, neighborfill, splinefill)
170171

171172
if kwargs.get("A") is None and inquire is False:

0 commit comments

Comments
 (0)