@@ -67,8 +67,9 @@ def _parse_fill_mode(
67
67
68
68
@fmt_docstring
69
69
# TODO(PyGMT>=0.19.0): Remove the deprecated 'no_data' parameter.
70
+ # TODO(PyGMT>=0.19.0): Remove the deprecated 'mode' parameter.
70
71
@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" )
72
73
@kwargs_to_strings (R = "sequence" )
73
74
def grdfill (
74
75
grid : str | xr .DataArray ,
@@ -78,6 +79,7 @@ def grdfill(
78
79
neighborfill : float | bool | None = None ,
79
80
splinefill : float | bool | None = None ,
80
81
inquire : bool = False ,
82
+ mode : str | None = None ,
81
83
** kwargs ,
82
84
) -> xr .DataArray | np .ndarray | None :
83
85
r"""
@@ -117,7 +119,7 @@ def grdfill(
117
119
Output the bounds of each hole. The bounds are returned as a 2-D numpy array in
118
120
the form of (west, east, south, north). No grid fill takes place and ``outgrid``
119
121
is ignored.
120
- mode : str
122
+ mode
121
123
Specify the hole-filling algorithm to use. Choose from **c** for constant fill
122
124
and append the constant value, **n** for nearest neighbor (and optionally append
123
125
a search radius in pixels [default radius is :math:`r^2 = \sqrt{{ X^2 + Y^2 }}`,
@@ -155,17 +157,16 @@ def grdfill(
155
157
array([[1.83333333, 6.16666667, 3.83333333, 8.16666667],
156
158
[6.16666667, 7.83333333, 0.5 , 2.5 ]])
157
159
"""
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.
160
161
warnings .warn (
161
162
"The 'mode' parameter is deprecated since v0.15.0 and will be removed in "
162
163
"v0.19.0. Use 'constantfill'/'gridfill'/'neighborfill'/'splinefill' "
163
164
"instead." ,
164
165
FutureWarning ,
165
166
stacklevel = 1 ,
166
167
)
168
+ kwargs ["A" ] = mode
167
169
else :
168
- # Determine the -A option from the fill parameters.
169
170
kwargs ["A" ] = _parse_fill_mode (constantfill , gridfill , neighborfill , splinefill )
170
171
171
172
if kwargs .get ("A" ) is None and inquire is False :
0 commit comments