Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions pygmt/src/grdgradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pygmt._typing import PathLike
from pygmt.alias import Alias, AliasSystem
from pygmt.clib import Session
from pygmt.exceptions import GMTInvalidInput, GMTParameterError
from pygmt.exceptions import GMTParameterError
from pygmt.helpers import build_arg_list, fmt_docstring, use_alias

__doctest_skip__ = ["grdgradient"]
Expand Down Expand Up @@ -54,12 +54,13 @@ def _alias_option_N( # noqa: N802
v is not None and v is not False
for v in [norm_amp, norm_ambient, norm_sigma, norm_offset]
):
msg = (
"Parameter 'normalize' using old syntax with raw GMT CLI string "
"conflicts with parameters 'norm_amp', 'norm_ambient', 'norm_sigma', "
"or 'norm_offset'."
raise GMTParameterError(
conflicts_with=(
"normalize",
["norm_amp", "norm_ambient", "norm_sigma", "norm_offset"],
),
reason="'normalize' is specified using the unrecommended GMT command string syntax.",
)
raise GMTInvalidInput(msg)
_normalize_mapping = None

return [
Expand Down
14 changes: 7 additions & 7 deletions pygmt/tests/test_grdgradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import xarray as xr
from pygmt import grdgradient
from pygmt.enums import GridRegistration, GridType
from pygmt.exceptions import GMTInvalidInput, GMTParameterError
from pygmt.exceptions import GMTParameterError
from pygmt.helpers import GMTTempFile
from pygmt.helpers.testing import load_static_earth_relief

Expand Down Expand Up @@ -75,17 +75,17 @@ def test_grdgradient_no_outgrid(grid, expected_grid):

def test_grdgradient_normalize_mixed_syntax(grid):
"""
Test that mixed syntax for normalize in grdgradient raises GMTInvalidInput.
Test that mixed syntax for normalize in grdgradient raises GMTParameterError.
"""
with pytest.raises(GMTInvalidInput):
with pytest.raises(GMTParameterError):
grdgradient(grid=grid, azimuth=10, normalize="t", norm_amp=2)
with pytest.raises(GMTInvalidInput):
with pytest.raises(GMTParameterError):
grdgradient(grid=grid, azimuth=10, normalize="t1", norm_amp=2)
with pytest.raises(GMTInvalidInput):
with pytest.raises(GMTParameterError):
grdgradient(grid=grid, azimuth=10, normalize="t1", norm_sigma=2)
with pytest.raises(GMTInvalidInput):
with pytest.raises(GMTParameterError):
grdgradient(grid=grid, azimuth=10, normalize="e", norm_offset=5)
with pytest.raises(GMTInvalidInput):
with pytest.raises(GMTParameterError):
grdgradient(grid=grid, azimuth=10, normalize="e", norm_ambient=0.1)


Expand Down
Loading