From 78551d240e72e16db622fab8c8916ef54e4b5077 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 17 Mar 2025 18:59:36 +0800 Subject: [PATCH 01/12] pygmt.grdfill: Add parameters 'constantfill/gridfill/neighborfill/splinefill' --- pygmt/src/grdfill.py | 95 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 85 insertions(+), 10 deletions(-) diff --git a/pygmt/src/grdfill.py b/pygmt/src/grdfill.py index 7188ea14497..a7acd3511aa 100644 --- a/pygmt/src/grdfill.py +++ b/pygmt/src/grdfill.py @@ -16,12 +16,62 @@ __doctest_skip__ = ["grdfill"] +def _parse_fill_mode( + constantfill=None, gridfill=None, neighborfill=None, splinefill=None +) -> str | None: + """ + Parse the fill parameters and return the appropriate string for the -A option. + + >>> import numpy as np + >>> import xarray as xr + >>> _parse_fill_mode(constantfill=20.0) + 'c20.0' + >>> _parse_fill_mode(gridfill="bggrid.nc") + 'g' + >>> _parse_fill_mode(gridfill=xr.DataArray(np.zeros((10, 10)))) + 'g' + >>> _parse_fill_mode(neighborfill=20) + 'n20' + >>> _parse_fill_mode(neighborfill=True) + 'n' + >>> _parse_fill_mode(splinefill=0.5) + 's0.5' + >>> _parse_fill_mode(splinefill=True) + 's' + """ + fill_params = [constantfill, gridfill, neighborfill, splinefill] + if sum(param is not None for param in fill_params) > 1: + msg = ( + "The 'constantfill', 'gridfill', 'neighborfill', and 'splinefill' " + "parameters are mutually exclusive." + ) + raise GMTInvalidInput(msg) + + if constantfill is not None: + return f"c{constantfill}" + if gridfill is not None: + return "g" # Append grid file name later to support xarray.DataArray. + if neighborfill is not None and neighborfill is not False: + return "n" if neighborfill is True else f"n{neighborfill}" + if splinefill is not None and splinefill is not False: + return "s" if splinefill is True else f"s{splinefill}" + return None + + @fmt_docstring # TODO(PyGMT>=0.19.0): Remove the deprecated 'no_data' parameter. @deprecate_parameter("no_data", "hole", "v0.15.0", remove_version="v0.19.0") @use_alias(A="mode", N="hole", R="region", V="verbose") @kwargs_to_strings(R="sequence") -def grdfill(grid, outgrid: str | None = None, **kwargs) -> xr.DataArray | None: +def grdfill( + grid: str | xr.DataArray, + outgrid: str | None = None, + constantfill: float | None = None, + gridfill: str | xr.DataArray | None = None, + neighborfill: float | bool | None = None, + splinefill: float | bool | None = None, + **kwargs, +) -> xr.DataArray | None: r""" Interpolate across holes in a grid. @@ -31,7 +81,7 @@ def grdfill(grid, outgrid: str | None = None, **kwargs) -> xr.DataArray | None: replace the hole values. If no holes are found the original unchanged grid is returned. - Full option list at :gmt-docs:`grdfill.html` + Full option list at :gmt-docs:`grdfill.html`. {aliases} @@ -39,17 +89,32 @@ def grdfill(grid, outgrid: str | None = None, **kwargs) -> xr.DataArray | None: ---------- {grid} {outgrid} - mode : str - Specify the hole-filling algorithm to use. Choose from **c** for - constant fill and append the constant value, **n** for nearest - neighbor (and optionally append a search radius in - pixels [default radius is :math:`r^2 = \sqrt{{ X^2 + Y^2 }}`, - where (*X,Y*) are the node dimensions of the grid]), or - **s** for bicubic spline (optionally append a *tension* - parameter [Default is no tension]). + constantfill + Fill the holes with a constant value. Specify the constant value to use. + gridfill + Fill the holes with values sampled from another (possibly coarser) grid. Specify + the grid (a file name or an :class:`xarray.DataArray`) to use for the fill. + neighborfill + Fill the holes with the nearest neighbor. Specify the search radius in pixels. + If set to ``True``, the default search radius will be used + (:math:`r^2 = \sqrt{{n^2 + m^2}}`, where (n,m) are the node dimensions of the + grid). + splinefill + Fill the holes with a bicubic spline. Specify the tension value to use. If set + to ``True``, no tension will be used. hole : float Set the node value used to identify a point as a member of a hole [Default is NaN]. + mode : str + Specify the hole-filling algorithm to use. Choose from **c** for constant fill + and append the constant value, **n** for nearest neighbor (and optionally append + a search radius in pixels [default radius is :math:`r^2 = \sqrt{{ X^2 + Y^2 }}`, + where (*X,Y*) are the node dimensions of the grid]), or **s** for bicubic spline + (optionally append a *tension* parameter [Default is no tension]). + + .. deprecated:: v0.15.0 + The ``mode`` parameter is deprecated since v0.15.0 and will be removed in + v0.19.0. Use ``constantfill/gridfill/neighborfill/splinefill`` instead. {region} {verbose} @@ -71,6 +136,10 @@ def grdfill(grid, outgrid: str | None = None, **kwargs) -> xr.DataArray | None: >>> # Set all empty values to "20" >>> filled_grid = pygmt.grdfill(grid=earth_relief_holes, mode="c20") """ + + # Determine the -A option from the fill parameters. + kwargs["A"] = _parse_fill_mode(constantfill, gridfill, neighborfill, splinefill) + if kwargs.get("A") is None and kwargs.get("L") is None: msg = "At least parameter 'mode' or 'L' must be specified." raise GMTInvalidInput(msg) @@ -78,8 +147,14 @@ def grdfill(grid, outgrid: str | None = None, **kwargs) -> xr.DataArray | None: with Session() as lib: with ( lib.virtualfile_in(check_kind="raster", data=grid) as vingrd, + lib.virtualfile_in( + check_kind="raster", data=gridfill, required_data=False + ) as vbggrd, lib.virtualfile_out(kind="grid", fname=outgrid) as voutgrd, ): + if gridfill is not None: + # Fill by a grid. Append the actual or virtual grid file name. + kwargs["A"] = f"g{vbggrd}" kwargs["G"] = voutgrd lib.call_module( module="grdfill", args=build_arg_list(kwargs, infile=vingrd) From 9bc443b711fe19fd3af0b943a1601ac5693a402d Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 17 Mar 2025 19:02:43 +0800 Subject: [PATCH 02/12] Update doctest and tests with the new parameters --- pygmt/src/grdfill.py | 5 ++--- pygmt/tests/test_grdfill.py | 25 +++++-------------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/pygmt/src/grdfill.py b/pygmt/src/grdfill.py index a7acd3511aa..69e22bcc147 100644 --- a/pygmt/src/grdfill.py +++ b/pygmt/src/grdfill.py @@ -132,9 +132,8 @@ def grdfill( >>> import pygmt >>> # Load a bathymetric grid with missing data >>> earth_relief_holes = pygmt.datasets.load_sample_data(name="earth_relief_holes") - >>> # Perform grid filling operations on the sample grid - >>> # Set all empty values to "20" - >>> filled_grid = pygmt.grdfill(grid=earth_relief_holes, mode="c20") + >>> # Fill the holes with a constant value of 20 + >>> filled_grid = pygmt.grdfill(grid=earth_relief_holes, constantfill=20) """ # Determine the -A option from the fill parameters. diff --git a/pygmt/tests/test_grdfill.py b/pygmt/tests/test_grdfill.py index 8d36125c279..75f9b70f0bd 100644 --- a/pygmt/tests/test_grdfill.py +++ b/pygmt/tests/test_grdfill.py @@ -49,23 +49,8 @@ def fixture_expected_grid(): [347.5, 331.5, 309.0, 282.0, 190.0, 208.0, 299.5, 348.0], ], coords={ - "lon": [-54.5, -53.5, -52.5, -51.5, -50.5, -49.5, -48.5, -47.5], - "lat": [ - -23.5, - -22.5, - -21.5, - -20.5, - -19.5, - -18.5, - -17.5, - -16.5, - -15.5, - -14.5, - -13.5, - -12.5, - -11.5, - -10.5, - ], + "lon": np.arange(-54.5, -46.5, 1), + "lat": np.arange(-23.5, -9.5, 1), }, dims=["lat", "lon"], ) @@ -76,7 +61,7 @@ def test_grdfill_dataarray_out(grid, expected_grid): """ Test grdfill with a DataArray output. """ - result = grdfill(grid=grid, mode="c20") + result = grdfill(grid=grid, constantfill=20) # check information of the output grid assert isinstance(result, xr.DataArray) assert result.gmt.gtype == GridType.GEOGRAPHIC @@ -91,7 +76,7 @@ def test_grdfill_asymmetric_pad(grid, expected_grid): Regression test for https://github.com/GenericMappingTools/pygmt/issues/1745. """ - result = grdfill(grid=grid, mode="c20", region=[-55, -50, -24, -16]) + result = grdfill(grid=grid, constantfill=20, region=[-55, -50, -24, -16]) # check information of the output grid assert isinstance(result, xr.DataArray) assert result.gmt.gtype == GridType.GEOGRAPHIC @@ -107,7 +92,7 @@ def test_grdfill_file_out(grid, expected_grid): Test grdfill with an outgrid set. """ with GMTTempFile(suffix=".nc") as tmpfile: - result = grdfill(grid=grid, mode="c20", outgrid=tmpfile.name) + result = grdfill(grid=grid, constantfill=20, outgrid=tmpfile.name) assert result is None # return value is None assert Path(tmpfile.name).stat().st_size > 0 # check that outfile exists temp_grid = load_dataarray(tmpfile.name) From 06c5ee5ecd14a818026b0c3b33bc42bce4766172 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 17 Mar 2025 19:03:43 +0800 Subject: [PATCH 03/12] Add a test for filling holes with a xr.DataArray grid --- pygmt/tests/test_grdfill.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pygmt/tests/test_grdfill.py b/pygmt/tests/test_grdfill.py index 75f9b70f0bd..c858d0b1ed9 100644 --- a/pygmt/tests/test_grdfill.py +++ b/pygmt/tests/test_grdfill.py @@ -99,6 +99,20 @@ def test_grdfill_file_out(grid, expected_grid): xr.testing.assert_allclose(a=temp_grid, b=expected_grid) +def test_grdfill_gridfill_dataarray(grid): + """ + Test grdfill with a DataArray input. + """ + bggrid = xr.DataArray( + np.arange(grid.size).reshape(grid.shape), + dims=grid.dims, + coords={"lon": grid.lon, "lat": grid.lat}, + ) + result = grdfill(grid=grid, gridfill=bggrid) + assert not result.isnull().any() + npt.assert_array_equal(result[3:6, 3:5], bggrid[3:6, 3:5]) + + def test_grdfill_required_args(grid): """ Test that grdfill fails without arguments for `mode` and `L`. From 433f6ba1acf77975b947d7f803fb6ab3a6aac9b8 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 17 Mar 2025 19:04:34 +0800 Subject: [PATCH 04/12] Add codes and tests for dealing with backward compatiblity for the mode parameter --- pygmt/src/grdfill.py | 25 ++++++++++++++++++++++--- pygmt/tests/test_grdfill.py | 21 +++++++++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/pygmt/src/grdfill.py b/pygmt/src/grdfill.py index 69e22bcc147..6706498f44f 100644 --- a/pygmt/src/grdfill.py +++ b/pygmt/src/grdfill.py @@ -2,6 +2,8 @@ grdfill - Interpolate across holes in a grid. """ +import warnings + import xarray as xr from pygmt.clib import Session from pygmt.exceptions import GMTInvalidInput @@ -135,9 +137,26 @@ def grdfill( >>> # Fill the holes with a constant value of 20 >>> filled_grid = pygmt.grdfill(grid=earth_relief_holes, constantfill=20) """ - - # Determine the -A option from the fill parameters. - kwargs["A"] = _parse_fill_mode(constantfill, gridfill, neighborfill, splinefill) + # TODO(PyGMT>=0.19.0): Remove the deprecated 'mode' parameter. + if kwargs.get("A") is not None: # The deprecated 'mode' parameter is given. + warnings.warn( + "The 'mode' parameter is deprecated since v0.15.0 and will be removed in " + "v0.19.0. Use 'constantfill/gridfill/neighborfill/splinefill' instead.", + FutureWarning, + stacklevel=1, + ) + if any( + param is not None + for param in [constantfill, gridfill, neighborfill, splinefill] + ): + msg = ( + "Parameters 'constantfill/gridfill/neighborfill/splinefill' " + "and 'mode' are mutually exclusive." + ) + raise GMTInvalidInput(msg) + else: + # Determine the -A option from the fill parameters. + kwargs["A"] = _parse_fill_mode(constantfill, gridfill, neighborfill, splinefill) if kwargs.get("A") is None and kwargs.get("L") is None: msg = "At least parameter 'mode' or 'L' must be specified." diff --git a/pygmt/tests/test_grdfill.py b/pygmt/tests/test_grdfill.py index c858d0b1ed9..7e1ec40535d 100644 --- a/pygmt/tests/test_grdfill.py +++ b/pygmt/tests/test_grdfill.py @@ -5,6 +5,7 @@ from pathlib import Path import numpy as np +import numpy.testing as npt import pytest import xarray as xr from pygmt import grdfill, load_dataarray @@ -119,3 +120,23 @@ def test_grdfill_required_args(grid): """ with pytest.raises(GMTInvalidInput): grdfill(grid=grid) + + +# TODO(PyGMT>=0.19.0): Remove this test. +def test_grdfill_deprecated_mode(grid, expected_grid): + """ + Test that grdfill fails with deprecated `mode` argument. + """ + with pytest.warns(FutureWarning): + result = grdfill(grid=grid, mode="c20") + xr.testing.assert_allclose(a=result, b=expected_grid) + + +# TODO(PyGMT>=0.19.0): Remove this test. +def test_grdfill_deprecated_mode_with_fill_parameters(grid): + """ + Test that grdfill fails with deprecated `mode` argument and fill parameters. + """ + with pytest.warns(FutureWarning): + with pytest.raises(GMTInvalidInput): + grdfill(grid=grid, mode="c20", constantfill=20) From 65d9e75d64a23faaffa967e75ca331fd07eeb993 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 17 Mar 2025 19:27:06 +0800 Subject: [PATCH 05/12] Fix the deprecation warning in docstring --- pygmt/src/grdfill.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/grdfill.py b/pygmt/src/grdfill.py index 6706498f44f..abd96942d87 100644 --- a/pygmt/src/grdfill.py +++ b/pygmt/src/grdfill.py @@ -114,7 +114,7 @@ def grdfill( where (*X,Y*) are the node dimensions of the grid]), or **s** for bicubic spline (optionally append a *tension* parameter [Default is no tension]). - .. deprecated:: v0.15.0 + .. deprecated:: 0.15.0 The ``mode`` parameter is deprecated since v0.15.0 and will be removed in v0.19.0. Use ``constantfill/gridfill/neighborfill/splinefill`` instead. {region} From 16b6440dfd6773beb110e3b91baa0d34da570d2f Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 17 Mar 2025 20:49:40 +0800 Subject: [PATCH 06/12] Update pygmt/src/grdfill.py Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com> --- pygmt/src/grdfill.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/grdfill.py b/pygmt/src/grdfill.py index abd96942d87..9453d9056e2 100644 --- a/pygmt/src/grdfill.py +++ b/pygmt/src/grdfill.py @@ -99,7 +99,7 @@ def grdfill( neighborfill Fill the holes with the nearest neighbor. Specify the search radius in pixels. If set to ``True``, the default search radius will be used - (:math:`r^2 = \sqrt{{n^2 + m^2}}`, where (n,m) are the node dimensions of the + (:math:`r^2 = \sqrt{{n^2 + m^2}}`, where (*n,m*) are the node dimensions of the grid). splinefill Fill the holes with a bicubic spline. Specify the tension value to use. If set From 7660de930163261cc20156e6261cf17a67f77c2c Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 17 Mar 2025 21:26:20 +0800 Subject: [PATCH 07/12] Update pygmt/src/grdfill.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> --- pygmt/src/grdfill.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/grdfill.py b/pygmt/src/grdfill.py index 9453d9056e2..ca42eed3362 100644 --- a/pygmt/src/grdfill.py +++ b/pygmt/src/grdfill.py @@ -116,7 +116,7 @@ def grdfill( .. deprecated:: 0.15.0 The ``mode`` parameter is deprecated since v0.15.0 and will be removed in - v0.19.0. Use ``constantfill/gridfill/neighborfill/splinefill`` instead. + v0.19.0. Use ``constantfill``, ``gridfill``, ``neighborfill`` or ``splinefill`` instead. {region} {verbose} From 98adb7b67527c458711cb9a79641c660365507a0 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 18 Mar 2025 12:24:42 +0800 Subject: [PATCH 08/12] Fix styling --- pygmt/src/grdfill.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pygmt/src/grdfill.py b/pygmt/src/grdfill.py index ca42eed3362..c6a62235f1d 100644 --- a/pygmt/src/grdfill.py +++ b/pygmt/src/grdfill.py @@ -116,7 +116,8 @@ def grdfill( .. deprecated:: 0.15.0 The ``mode`` parameter is deprecated since v0.15.0 and will be removed in - v0.19.0. Use ``constantfill``, ``gridfill``, ``neighborfill`` or ``splinefill`` instead. + v0.19.0. Use ``constantfill``, ``gridfill``, ``neighborfill``, or + ``splinefill`` instead. {region} {verbose} From 0b890db30d88c417aa89515f0ac8f4815f6d258c Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 18 Mar 2025 12:26:47 +0800 Subject: [PATCH 09/12] Improve warning messages --- pygmt/src/grdfill.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pygmt/src/grdfill.py b/pygmt/src/grdfill.py index c6a62235f1d..6192a5ae48f 100644 --- a/pygmt/src/grdfill.py +++ b/pygmt/src/grdfill.py @@ -116,7 +116,7 @@ def grdfill( .. deprecated:: 0.15.0 The ``mode`` parameter is deprecated since v0.15.0 and will be removed in - v0.19.0. Use ``constantfill``, ``gridfill``, ``neighborfill``, or + v0.19.0. Use ``constantfill``, ``gridfill``, ``neighborfill``, or ``splinefill`` instead. {region} {verbose} @@ -142,7 +142,8 @@ def grdfill( if kwargs.get("A") is not None: # The deprecated 'mode' parameter is given. warnings.warn( "The 'mode' parameter is deprecated since v0.15.0 and will be removed in " - "v0.19.0. Use 'constantfill/gridfill/neighborfill/splinefill' instead.", + "v0.19.0. Use 'constantfill'/'gridfill'/'neighborfill'/'splinefill' " + "instead.", FutureWarning, stacklevel=1, ) @@ -151,8 +152,8 @@ def grdfill( for param in [constantfill, gridfill, neighborfill, splinefill] ): msg = ( - "Parameters 'constantfill/gridfill/neighborfill/splinefill' " - "and 'mode' are mutually exclusive." + "Parameters 'constantfill'/'gridfill'/'neighborfill'/'splinefill' and " + "'mode' are mutually exclusive." ) raise GMTInvalidInput(msg) else: From e1600a7332ff3a19d39dcf125d39b97803b42923 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 18 Mar 2025 12:41:03 +0800 Subject: [PATCH 10/12] Add one more test to increase code coverage --- pygmt/src/grdfill.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pygmt/src/grdfill.py b/pygmt/src/grdfill.py index 6192a5ae48f..89ac84d4a6d 100644 --- a/pygmt/src/grdfill.py +++ b/pygmt/src/grdfill.py @@ -40,6 +40,10 @@ def _parse_fill_mode( 's0.5' >>> _parse_fill_mode(splinefill=True) 's' + >>> _parse_fill_mode(constantfill=20, gridfill="bggrid.nc") + Traceback (most recent call last): + ... + pygmt.exceptions.GMTInvalidInput: The ... parameters are mutually exclusive. """ fill_params = [constantfill, gridfill, neighborfill, splinefill] if sum(param is not None for param in fill_params) > 1: From 242fae218fc46976d5cb86d2ea0fffa39f2ac298 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 18 Mar 2025 13:23:02 +0800 Subject: [PATCH 11/12] Simplify the deprecation docstring --- pygmt/src/grdfill.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pygmt/src/grdfill.py b/pygmt/src/grdfill.py index 89ac84d4a6d..f3189cf37ce 100644 --- a/pygmt/src/grdfill.py +++ b/pygmt/src/grdfill.py @@ -119,9 +119,8 @@ def grdfill( (optionally append a *tension* parameter [Default is no tension]). .. deprecated:: 0.15.0 - The ``mode`` parameter is deprecated since v0.15.0 and will be removed in - v0.19.0. Use ``constantfill``, ``gridfill``, ``neighborfill``, or - ``splinefill`` instead. + Use ``constantfill``, ``gridfill``, ``neighborfill``, or ``splinefill`` + instead. The parameter will be removed in v0.19.0. {region} {verbose} From e03b6eaaef911eaa3e6419b528403cf82d9d7712 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 19 Mar 2025 23:51:23 +0800 Subject: [PATCH 12/12] No need to check if mode and fill parameters are used at the same time --- pygmt/src/grdfill.py | 9 --------- pygmt/tests/test_grdfill.py | 10 ---------- 2 files changed, 19 deletions(-) diff --git a/pygmt/src/grdfill.py b/pygmt/src/grdfill.py index f3189cf37ce..a6f489c8121 100644 --- a/pygmt/src/grdfill.py +++ b/pygmt/src/grdfill.py @@ -150,15 +150,6 @@ def grdfill( FutureWarning, stacklevel=1, ) - if any( - param is not None - for param in [constantfill, gridfill, neighborfill, splinefill] - ): - msg = ( - "Parameters 'constantfill'/'gridfill'/'neighborfill'/'splinefill' and " - "'mode' are mutually exclusive." - ) - raise GMTInvalidInput(msg) else: # Determine the -A option from the fill parameters. kwargs["A"] = _parse_fill_mode(constantfill, gridfill, neighborfill, splinefill) diff --git a/pygmt/tests/test_grdfill.py b/pygmt/tests/test_grdfill.py index 7e1ec40535d..8763a482383 100644 --- a/pygmt/tests/test_grdfill.py +++ b/pygmt/tests/test_grdfill.py @@ -130,13 +130,3 @@ def test_grdfill_deprecated_mode(grid, expected_grid): with pytest.warns(FutureWarning): result = grdfill(grid=grid, mode="c20") xr.testing.assert_allclose(a=result, b=expected_grid) - - -# TODO(PyGMT>=0.19.0): Remove this test. -def test_grdfill_deprecated_mode_with_fill_parameters(grid): - """ - Test that grdfill fails with deprecated `mode` argument and fill parameters. - """ - with pytest.warns(FutureWarning): - with pytest.raises(GMTInvalidInput): - grdfill(grid=grid, mode="c20", constantfill=20)