Skip to content

Commit 3522d5e

Browse files
Update pygmt/src/binstats.py
Co-authored-by: Dongdong Tian <[email protected]>
1 parent 3ab14d0 commit 3522d5e

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

pygmt/src/binstats.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,18 @@ def binstats(
167167
)
168168
aliasdict.merge(kwargs)
169169
if statistic == "quantile":
170-
if isinstance(quantile_value, (int, float)):
171-
if 0 <= quantile_value <= 100:
172-
aliasdict["C"] += f"{quantile_value}"
173-
else:
174-
msg = "quantile_value must be a value between 0 and 100."
175-
raise GMTInvalidInput(msg)
176-
else:
177-
msg = "quantile_value must be an 'int' or 'float'."
178-
raise GMTInvalidInput(msg)
170+
if not isinstance(quantile_value, (int, float)):
171+
raise GMTTypeError(
172+
quantile_value,
173+
reason="quantile_value must be an 'int' or 'float'."
174+
)
175+
if not (0 <= quantile_value <= 100):
176+
raise GMTValueError(
177+
quantile_value,
178+
description="quantile_value",
179+
reason="Must be a value between 0 and 100."
180+
)
181+
aliasdict["C"] += f"{quantile_value}"
179182

180183
with Session() as lib:
181184
with (

0 commit comments

Comments
 (0)