42
42
43
43
44
44
def _validate_data_input (
45
- data = None , x = None , y = None , z = None , required_data = True , required_ncols = 2 , kind = None
45
+ data = None , x = None , y = None , z = None , required_data = True , ncols = 2 , kind = None
46
46
) -> None :
47
47
"""
48
48
Check if the combination of data/x/y/z is valid.
@@ -65,29 +65,29 @@ def _validate_data_input(
65
65
Traceback (most recent call last):
66
66
...
67
67
pygmt.exceptions.GMTInvalidInput: Must provide both x and y.
68
- >>> _validate_data_input(x=[1, 2, 3], y=[4, 5, 6], required_ncols =3)
68
+ >>> _validate_data_input(x=[1, 2, 3], y=[4, 5, 6], ncols =3)
69
69
Traceback (most recent call last):
70
70
...
71
71
pygmt.exceptions.GMTInvalidInput: Must provide x, y, and z.
72
72
>>> import numpy as np
73
73
>>> import pandas as pd
74
74
>>> import xarray as xr
75
75
>>> data = np.arange(8).reshape((4, 2))
76
- >>> _validate_data_input(data=data, required_ncols =3, kind="matrix")
76
+ >>> _validate_data_input(data=data, ncols =3, kind="matrix")
77
77
Traceback (most recent call last):
78
78
...
79
79
pygmt.exceptions.GMTInvalidInput: data must provide x, y, and z columns.
80
80
>>> _validate_data_input(
81
81
... data=pd.DataFrame(data, columns=["x", "y"]),
82
- ... required_ncols =3,
82
+ ... ncols =3,
83
83
... kind="vectors",
84
84
... )
85
85
Traceback (most recent call last):
86
86
...
87
87
pygmt.exceptions.GMTInvalidInput: data must provide x, y, and z columns.
88
88
>>> _validate_data_input(
89
89
... data=xr.Dataset(pd.DataFrame(data, columns=["x", "y"])),
90
- ... required_ncols =3,
90
+ ... ncols =3,
91
91
... kind="vectors",
92
92
... )
93
93
Traceback (most recent call last):
@@ -115,7 +115,7 @@ def _validate_data_input(
115
115
GMTInvalidInput
116
116
If the data input is not valid.
117
117
"""
118
- required_z = required_ncols >= 3
118
+ required_z = ncols >= 3
119
119
if data is None : # data is None
120
120
if x is None and y is None : # both x and y are None
121
121
if required_data : # data is not optional
0 commit comments