Skip to content

Commit 008a56f

Browse files
committed
Remove the unused x/y/z/required_z parameters from data_kind
1 parent e2a8ceb commit 008a56f

File tree

5 files changed

+13
-21
lines changed

5 files changed

+13
-21
lines changed

pygmt/clib/session.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,9 +1592,7 @@ def virtualfile_in( # noqa: PLR0912
15921592
... print(fout.read().strip())
15931593
<vector memory>: N = 3 <7/9> <4/6> <1/3>
15941594
"""
1595-
kind = data_kind(
1596-
data, x, y, z, required_z=required_z, required_data=required_data
1597-
)
1595+
kind = data_kind(data, required_data=required_data)
15981596
validate_data_input(
15991597
data=data,
16001598
x=x,

pygmt/helpers/utils.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def validate_data_input(
115115
raise GMTInvalidInput("data must provide x, y, and z columns.")
116116

117117

118-
def data_kind(data=None, x=None, y=None, z=None, required_z=False, required_data=True):
118+
def data_kind(data=None, required_data=True):
119119
"""
120120
Check what kind of data is provided to a module.
121121
@@ -137,12 +137,6 @@ def data_kind(data=None, x=None, y=None, z=None, required_z=False, required_data
137137
Pass in either a file name or :class:`pathlib.Path` to an ASCII data
138138
table, an :class:`xarray.DataArray`, a 1-D/2-D
139139
{table-classes} or an option argument.
140-
x/y : 1-D arrays or None
141-
x and y columns as numpy arrays.
142-
z : 1-D array or None
143-
z column as numpy array. To be used optionally when x and y are given.
144-
required_z : bool
145-
State whether the 'z' column is required.
146140
required_data : bool
147141
Set to True when 'data' is required, or False when dealing with
148142
optional virtual files. [Default is True].
@@ -159,19 +153,19 @@ def data_kind(data=None, x=None, y=None, z=None, required_z=False, required_data
159153
>>> import numpy as np
160154
>>> import xarray as xr
161155
>>> import pathlib
162-
>>> data_kind(data=None, x=np.array([1, 2, 3]), y=np.array([4, 5, 6]))
156+
>>> data_kind(data=None)
163157
'vectors'
164-
>>> data_kind(data=np.arange(10).reshape((5, 2)), x=None, y=None)
158+
>>> data_kind(data=np.arange(10).reshape((5, 2)))
165159
'matrix'
166-
>>> data_kind(data="my-data-file.txt", x=None, y=None)
160+
>>> data_kind(data="my-data-file.txt")
167161
'file'
168-
>>> data_kind(data=pathlib.Path("my-data-file.txt"), x=None, y=None)
162+
>>> data_kind(data=pathlib.Path("my-data-file.txt"))
169163
'file'
170-
>>> data_kind(data=None, x=None, y=None, required_data=False)
164+
>>> data_kind(data=None, required_data=False)
171165
'arg'
172-
>>> data_kind(data=2.0, x=None, y=None, required_data=False)
166+
>>> data_kind(data=2.0, required_data=False)
173167
'arg'
174-
>>> data_kind(data=True, x=None, y=None, required_data=False)
168+
>>> data_kind(data=True, required_data=False)
175169
'arg'
176170
>>> data_kind(data=xr.DataArray(np.random.rand(4, 3)))
177171
'grid'

pygmt/src/plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def plot( # noqa: PLR0912
208208
"""
209209
kwargs = self._preprocess(**kwargs)
210210

211-
kind = data_kind(data, x, y)
211+
kind = data_kind(data)
212212
extra_arrays = []
213213
if kind == "vectors": # Add more columns for vectors input
214214
# Parameters for vector styles

pygmt/src/plot3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def plot3d( # noqa: PLR0912
183183
"""
184184
kwargs = self._preprocess(**kwargs)
185185

186-
kind = data_kind(data, x, y, z)
186+
kind = data_kind(data)
187187
extra_arrays = []
188188

189189
if kind == "vectors": # Add more columns for vectors input

pygmt/src/text.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,11 @@ def text_( # noqa: PLR0912
180180

181181
# Ensure inputs are either textfiles, x/y/text, or position/text
182182
if position is None:
183-
if (x is not None or y is not None) and textfiles is not None:
183+
if any(v is not None for v in (x, y, text)) and textfiles is not None:
184184
raise GMTInvalidInput(
185185
"Provide either position only, or x/y pairs, or textfiles."
186186
)
187-
kind = data_kind(textfiles, x, y, text)
187+
kind = data_kind(textfiles)
188188
if kind == "vectors" and text is None:
189189
raise GMTInvalidInput("Must provide text with x/y pairs")
190190
else:

0 commit comments

Comments
 (0)