22grdfill - Interpolate across holes in a grid.
33"""
44
5- import warnings
65from collections .abc import Sequence
76from typing import Literal
87
@@ -23,14 +22,12 @@ def _validate_params(
2322 neighbor_fill = None ,
2423 spline_fill = None ,
2524 inquire = False ,
26- mode = None ,
2725):
2826 """
2927 Validate the fill/inquire parameters.
3028
3129 >>> _validate_params(constant_fill=20.0)
3230 >>> _validate_params(inquire=True)
33- >>> _validate_params(mode="c20.0")
3431 >>> _validate_params(constant_fill=20.0, grid_fill="bggrid.nc")
3532 Traceback (most recent call last):
3633 ...
@@ -45,13 +42,6 @@ def _validate_params(
4542 pygmt.exceptions.GMTInvalidInput: Need to specify parameter ...
4643 """
4744 _fill_params = "'constant_fill'/'grid_fill'/'neighbor_fill'/'spline_fill'"
48- # The deprecated 'mode' parameter is given.
49- if mode is not None :
50- msg = (
51- "The 'mode' parameter is deprecated since v0.15.0 and will be removed in "
52- f"v0.19.0. Use { _fill_params } instead."
53- )
54- warnings .warn (msg , FutureWarning , stacklevel = 2 )
5545
5646 n_given = sum (
5747 param is not None and param is not False
@@ -61,11 +51,10 @@ def _validate_params(
6151 neighbor_fill ,
6252 spline_fill ,
6353 inquire ,
64- mode ,
6554 ]
6655 )
6756 if n_given > 1 : # More than one mutually exclusive parameter is given.
68- msg = f"Parameters { _fill_params } /'inquire'/'mode' are mutually exclusive."
57+ msg = f"Parameters { _fill_params } /'inquire' are mutually exclusive."
6958 raise GMTInvalidInput (msg )
7059 if n_given == 0 : # No parameters are given.
7160 msg = (
@@ -76,7 +65,6 @@ def _validate_params(
7665
7766
7867@fmt_docstring
79- # TODO(PyGMT>=0.19.0): Remove the deprecated 'mode' parameter.
8068# TODO(PyGMT>=0.20.0): Remove the deprecated '*fill' parameters.
8169@deprecate_parameter (
8270 "constantfill" , "constant_fill" , "v0.18.0" , remove_version = "v0.20.0"
@@ -87,7 +75,7 @@ def _validate_params(
8775)
8876@deprecate_parameter ("splinefill" , "spline_fill" , "v0.18.0" , remove_version = "v0.20.0" )
8977@use_alias (f = "coltypes" )
90- def grdfill ( # noqa: PLR0913
78+ def grdfill (
9179 grid : PathLike | xr .DataArray ,
9280 outgrid : PathLike | None = None ,
9381 constant_fill : float | None = None ,
@@ -96,7 +84,6 @@ def grdfill( # noqa: PLR0913
9684 spline_fill : float | bool | None = None ,
9785 inquire : bool = False ,
9886 hole : float | None = None ,
99- mode : str | None = None ,
10087 region : Sequence [float | str ] | str | None = None ,
10188 verbose : Literal ["quiet" , "error" , "warning" , "timing" , "info" , "compat" , "debug" ]
10289 | bool = False ,
@@ -147,16 +134,6 @@ def grdfill( # noqa: PLR0913
147134 Output the bounds of each hole. The bounds are returned as a 2-D numpy array in
148135 the form of (west, east, south, north). No grid fill takes place and ``outgrid``
149136 is ignored.
150- mode
151- Specify the hole-filling algorithm to use. Choose from **c** for constant fill
152- and append the constant value, **n** for nearest neighbor (and optionally append
153- a search radius in pixels [default radius is :math:`r^2 = \sqrt{ X^2 + Y^2 }`,
154- where (*X,Y*) are the node dimensions of the grid]), or **s** for bicubic spline
155- (optionally append a *tension* parameter [Default is no tension]).
156-
157- .. deprecated:: 0.15.0
158- Use ``constant_fill``, ``grid_fill``, ``neighbor_fill``, or ``spline_fill``
159- instead. The parameter will be removed in v0.19.0.
160137
161138 $region
162139 $coltypes
@@ -189,13 +166,10 @@ def grdfill( # noqa: PLR0913
189166 [6.16666667, 7.83333333, 0.5 , 2.5 ]])
190167 """
191168 # Validate the fill/inquire parameters.
192- _validate_params (
193- constant_fill , grid_fill , neighbor_fill , spline_fill , inquire , mode
194- )
169+ _validate_params (constant_fill , grid_fill , neighbor_fill , spline_fill , inquire )
195170
196171 # _validate_params has already ensured that only one of the parameters is set.
197172 aliasdict = AliasSystem (
198- A = Alias (mode , name = "mode" ),
199173 Ac = Alias (constant_fill , name = "constant_fill" ),
200174 # For grid_fill, append the actual or virtual grid file name later.
201175 Ag = Alias (grid_fill is not None , name = "grid_fill" ),
0 commit comments