File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111from pygmt ._typing import PathLike
1212from pygmt .alias import AliasSystem
1313from pygmt .clib import Session
14- from pygmt .exceptions import GMTInvalidInput
14+ from pygmt .exceptions import GMTParameterError
1515from pygmt .helpers import (
1616 build_arg_list ,
1717 fmt_docstring ,
@@ -235,8 +235,10 @@ def compute_bins(
235235 output_type = validate_output_table_type (output_type , outfile = outfile )
236236
237237 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+ )
240242
241243 aliasdict = AliasSystem ().add_common (
242244 R = region ,
Original file line number Diff line number Diff line change 1010import xarray as xr
1111from pygmt import grdhisteq
1212from pygmt .enums import GridRegistration , GridType
13- from pygmt .exceptions import GMTInvalidInput , GMTValueError
13+ from pygmt .exceptions import GMTParameterError , GMTValueError
1414from pygmt .helpers import GMTTempFile
1515from pygmt .helpers .testing import load_static_earth_relief
1616
@@ -138,5 +138,5 @@ def test_compute_bins_invalid_format(grid):
138138 """
139139 with pytest .raises (GMTValueError ):
140140 grdhisteq .compute_bins (grid = grid , output_type = 1 )
141- with pytest .raises (GMTInvalidInput ):
141+ with pytest .raises (GMTParameterError ):
142142 grdhisteq .compute_bins (grid = grid , output_type = "pandas" , header = "o+c" )
You can’t perform that action at this time.
0 commit comments