Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions pygmt/src/grdproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ def grdproject( # noqa: PLR0913
msg = "Parameter 'projection' must be specified."
raise GMTInvalidInput(msg)

if kwargs.get("M") and kwargs.get("F"):
Comment thread
willschlitzer marked this conversation as resolved.
Outdated
msg = "Cannot use both 'unit' and 'scaling;."
Comment thread
willschlitzer marked this conversation as resolved.
Outdated
raise GMTInvalidInput(msg)

aliasdict = AliasSystem(
C=Alias(center, name="center", sep="/", size=2),
D=Alias(spacing, name="spacing", sep="/", size=2),
Expand Down
14 changes: 14 additions & 0 deletions pygmt/tests/test_grdproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ def test_grdproject_no_outgrid(grid, projection, expected_grid):
xr.testing.assert_allclose(a=result, b=expected_grid)


def test_grdproject_unit_scaling(grid):
"""
Test that the validation for passing boht 'unit' and 'scaling' is performed.
"""
with pytest.raises(GMTInvalidInput):
grdproject(
grid=grid,
projection="M10c",
spacing=3,
unit="i",
Comment thread
willschlitzer marked this conversation as resolved.
region=[-53, -51, -20, -17],
)


def test_grdproject_fails(grid):
"""
Check that grdproject fails correctly.
Expand Down
Loading