GeezerVison is showing github.com — Merge branch 'main' into subplot/A · GenericMappingTools/pygmt@b24ca35
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard +16-7Lines changed: 16 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # Map author/committer names and/or email addresses for git. | 2 | 2 | # Reference: https://git-scm.com/docs/gitmailmap | | 3 | + | | 4 | +# Canonical identities: "Canonical Name <Canonical Email>" | 3 | 5 | | 4 | | - | 5 | 6 | | 6 | | - | 7 | 7 | | 8 | | - | 9 | 8 | | | 9 | + | | 10 | + | | 11 | + | | 12 | + | | 13 | + | | 14 | + | | 15 | +# Alias mappings: "Canonical Name <Canonical Email> <Alias Email>" | | 16 | + | | 17 | + | | 18 | + | 10 | 19 | | 11 | 20 | | 12 | 21 | | 13 | | - | 14 | | - | 15 | | - | 16 | | - | | 22 | + | | 23 | + | | 24 | + | 17 | 25 | | 18 | 26 | | 19 | 27 | | | 28 | + | 20 | 29 | | 21 | 30 | |
Collapse file Copy file name to clipboardExpand all lines: pygmt/src/grdhisteq.py +5-3Lines changed: 5 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 11 | 11 | from pygmt._typing import PathLike | 12 | 12 | from pygmt.alias import AliasSystem | 13 | 13 | from pygmt.clib import Session | 14 | | -from pygmt.exceptions import GMTInvalidInput | | 14 | +from pygmt.exceptions import GMTParameterError | 15 | 15 | from pygmt.helpers import ( | 16 | 16 | build_arg_list, | 17 | 17 | fmt_docstring, | @@ -235,8 +235,10 @@ def compute_bins( | 235 | 235 | output_type = validate_output_table_type(output_type, outfile=outfile) | 236 | 236 |
| 237 | 237 | if kwargs.get("h") is not None and output_type != "file": | 238 | | - msg = "'header' is only allowed with output_type='file'." | 239 | | - raise GMTInvalidInput(msg) | | 238 | + raise GMTParameterError( | | 239 | + conflicts_with=("header", [f"output_type={output_type!r}"]), | | 240 | + reason="'header' is allowed only when 'output_type' is 'file'.", | | 241 | + ) | 240 | 242 |
| 241 | 243 | aliasdict = AliasSystem().add_common( | 242 | 244 | R=region, | |
Collapse file Copy file name to clipboardExpand all lines: pygmt/src/grdview.py +12-9Lines changed: 12 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 10 | 10 | from pygmt._typing import PathLike | 11 | 11 | from pygmt.alias import Alias, AliasSystem | 12 | 12 | from pygmt.clib import Session, __gmt_version__ | 13 | | -from pygmt.exceptions import GMTInvalidInput, GMTParameterError | | 13 | +from pygmt.exceptions import GMTParameterError | 14 | 14 | from pygmt.helpers import build_arg_list, deprecate_parameter, fmt_docstring, use_alias | 15 | 15 | from pygmt.src.grdinfo import grdinfo | 16 | 16 |
| @@ -80,17 +80,20 @@ def _alias_option_Q( # noqa: N802 | 80 | 80 | ) | 81 | 81 |
| 82 | 82 | if dpi is not None and surftype != "image": | 83 | | - msg = "Parameter 'dpi' can only be used when 'surftype' is 'image'." | 84 | | - raise GMTInvalidInput(msg) | | 83 | + raise GMTParameterError( | | 84 | + conflicts_with=("dpi", [f"surftype={surftype!r}"]), | | 85 | + reason="'dpi' is allowed only when 'surftype' is 'image'.", | | 86 | + ) | 85 | 87 | if nan_transparent and surftype != "image": | 86 | | - msg = "Parameter 'nan_transparent' can only be used when 'surftype' is 'image'." | 87 | | - raise GMTInvalidInput(msg) | | 88 | + raise GMTParameterError( | | 89 | + conflicts_with=("nan_transparent", [f"surftype={surftype!r}"]), | | 90 | + reason="'nan_transparent' is allowed only when 'surftype' is 'image'.", | | 91 | + ) | 88 | 92 | if mesh_fill is not None and surftype not in {"mesh", "waterfall_x", "waterfall_y"}: | 89 | | - msg = ( | 90 | | - "Parameter 'mesh_fill' can only be used when 'surftype' is 'mesh', " | 91 | | - "'waterfall_x', or 'waterfall_y'." | | 93 | + raise GMTParameterError( | | 94 | + conflicts_with=("mesh_fill", [f"surftype={surftype!r}"]), | | 95 | + reason="'mesh_fill' is allowed only when 'surftype' is 'mesh', 'waterfall_x', or 'waterfall_y'.", | 92 | 96 | ) | 93 | | - raise GMTInvalidInput(msg) | 94 | 97 |
| 95 | 98 | return [ | 96 | 99 | Alias( | |
Collapse file Copy file name to clipboardExpand all lines: pygmt/tests/test_grdhisteq.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 10 | 10 | import xarray as xr | 11 | 11 | from pygmt import grdhisteq | 12 | 12 | from pygmt.enums import GridRegistration, GridType | 13 | | -from pygmt.exceptions import GMTInvalidInput, GMTValueError | | 13 | +from pygmt.exceptions import GMTParameterError, GMTValueError | 14 | 14 | from pygmt.helpers import GMTTempFile | 15 | 15 | from pygmt.helpers.testing import load_static_earth_relief | 16 | 16 |
| @@ -138,5 +138,5 @@ def test_compute_bins_invalid_format(grid): | 138 | 138 | """ | 139 | 139 | with pytest.raises(GMTValueError): | 140 | 140 | grdhisteq.compute_bins(grid=grid, output_type=1) | 141 | | - with pytest.raises(GMTInvalidInput): | | 141 | + with pytest.raises(GMTParameterError): | 142 | 142 | grdhisteq.compute_bins(grid=grid, output_type="pandas", header="o+c") |
Collapse file Copy file name to clipboardExpand all lines: pygmt/tests/test_grdview.py +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 |
| 5 | 5 | import pytest | 6 | 6 | from pygmt import Figure, grdcut | 7 | | -from pygmt.exceptions import GMTInvalidInput, GMTParameterError, GMTTypeError | | 7 | +from pygmt.exceptions import GMTParameterError, GMTTypeError | 8 | 8 | from pygmt.helpers import GMTTempFile | 9 | 9 | from pygmt.helpers.testing import load_static_earth_relief | 10 | 10 |
| @@ -330,11 +330,11 @@ def test_grdview_invalid_surftype(gridfile): | 330 | 330 | parameters. | 331 | 331 | """ | 332 | 332 | fig = Figure() | 333 | | - with pytest.raises(GMTInvalidInput): | | 333 | + with pytest.raises(GMTParameterError): | 334 | 334 | fig.grdview(grid=gridfile, surftype="surface", dpi=300) | 335 | | - with pytest.raises(GMTInvalidInput): | | 335 | + with pytest.raises(GMTParameterError): | 336 | 336 | fig.grdview(grid=gridfile, surftype="surface", nan_transparent=True) | 337 | | - with pytest.raises(GMTInvalidInput): | | 337 | + with pytest.raises(GMTParameterError): | 338 | 338 | fig.grdview(grid=gridfile, surftype="surface", mesh_fill="red") | 339 | 339 |
| 340 | 340 |
| |
|