Skip to content

Commit bc09dcb

Browse files
committed
Let velo's spec work with None inputs
Or rather, catch it properly if someone uses spec=None.
1 parent 58390de commit bc09dcb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pygmt/src/velo.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,12 @@ def velo(self, data=None, **kwargs):
238238
"""
239239
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
240240

241-
if "S" not in kwargs or ("S" in kwargs and not isinstance(kwargs["S"], str)):
242-
raise GMTInvalidInput("Spec is a required argument and has to be a string.")
241+
if kwargs.get("S") is None or (
242+
kwargs.get("S") is not None and not isinstance(kwargs["S"], str)
243+
):
244+
raise GMTInvalidInput(
245+
"The parameter `spec` is required and has to be a string."
246+
)
243247

244248
if isinstance(data, np.ndarray) and not pd.api.types.is_numeric_dtype(data):
245249
raise GMTInvalidInput(

0 commit comments

Comments
 (0)