@@ -80,13 +80,14 @@ def _validate_data_input( # noqa: PLR0912
80
80
>>> _validate_data_input(
81
81
... data=pd.DataFrame(data, columns=["x", "y"]),
82
82
... required_cols=3,
83
- ... kind="matrix ",
83
+ ... kind="vectors ",
84
84
... )
85
85
Traceback (most recent call last):
86
86
...
87
87
pygmt.exceptions.GMTInvalidInput: data needs 3 columns but 2 column(s) are given.
88
88
>>> _validate_data_input(
89
89
... data=xr.Dataset(pd.DataFrame(data, columns=["x", "y"])),
90
+ ... kind="vectors",
90
91
... required_cols=3,
91
92
... )
92
93
Traceback (most recent call last):
@@ -122,15 +123,15 @@ def _validate_data_input( # noqa: PLR0912
122
123
raise GMTInvalidInput (msg )
123
124
124
125
match kind :
125
- case "none " :
126
- if x is None and y is None : # both x and y are None
126
+ case "empty " :
127
+ if x is None and y is None : # Both x and y are None.
127
128
msg = "No input data provided."
128
129
raise GMTInvalidInput (msg )
129
- if x is None or y is None : # either x or y is None
130
+ if x is None or y is None : # Either x or y is None.
130
131
msg = "Must provide both x and y."
131
132
raise GMTInvalidInput (msg )
132
133
if required_cols >= 3 and z is None :
133
- # both x and y are not None, now check z
134
+ # Both x and y are not None, now check z.
134
135
msg = "Must provide x, y, and z."
135
136
raise GMTInvalidInput (msg )
136
137
case "matrix" : # 2-D numpy.ndarray
@@ -269,9 +270,9 @@ def _check_encoding(argstr: str) -> Encoding:
269
270
270
271
271
272
def data_kind (
272
- data : Any = None , required : bool = True
273
+ data : Any , required : bool = True
273
274
) -> Literal [
274
- "empty " , "arg " , "file" , "geojson" , "grid" , "image" , "matrix" , "stringio" , "vectors"
275
+ "arg " , "empty " , "file" , "geojson" , "grid" , "image" , "matrix" , "stringio" , "vectors"
275
276
]:
276
277
r"""
277
278
Check the kind of data that is provided to a module.
0 commit comments