Skip to content

Commit 5eeb37b

Browse files
committed
Rename required_ncols to the shorter ncols
1 parent 84e8d8a commit 5eeb37b

File tree

12 files changed

+22
-26
lines changed

12 files changed

+22
-26
lines changed

pygmt/clib/session.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ def virtualfile_in(
17741774
z=None,
17751775
extra_arrays=None,
17761776
required_data=True,
1777-
required_ncols=2,
1777+
ncols=2,
17781778
):
17791779
"""
17801780
Store any data inside a virtual file.
@@ -1800,7 +1800,7 @@ def virtualfile_in(
18001800
required_data : bool
18011801
Set to True when 'data' is required, or False when dealing with
18021802
optional virtual files. [Default is True].
1803-
required_ncols
1803+
ncols
18041804
Number of minimum required columns.
18051805
18061806
Returns
@@ -1836,7 +1836,7 @@ def virtualfile_in(
18361836
y=y,
18371837
z=z,
18381838
required_data=required_data,
1839-
required_ncols=required_ncols,
1839+
ncols=ncols,
18401840
kind=kind,
18411841
)
18421842

pygmt/helpers/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343

4444
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
4646
) -> None:
4747
"""
4848
Check if the combination of data/x/y/z is valid.
@@ -65,29 +65,29 @@ def _validate_data_input(
6565
Traceback (most recent call last):
6666
...
6767
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)
6969
Traceback (most recent call last):
7070
...
7171
pygmt.exceptions.GMTInvalidInput: Must provide x, y, and z.
7272
>>> import numpy as np
7373
>>> import pandas as pd
7474
>>> import xarray as xr
7575
>>> 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")
7777
Traceback (most recent call last):
7878
...
7979
pygmt.exceptions.GMTInvalidInput: data must provide x, y, and z columns.
8080
>>> _validate_data_input(
8181
... data=pd.DataFrame(data, columns=["x", "y"]),
82-
... required_ncols=3,
82+
... ncols=3,
8383
... kind="vectors",
8484
... )
8585
Traceback (most recent call last):
8686
...
8787
pygmt.exceptions.GMTInvalidInput: data must provide x, y, and z columns.
8888
>>> _validate_data_input(
8989
... data=xr.Dataset(pd.DataFrame(data, columns=["x", "y"])),
90-
... required_ncols=3,
90+
... ncols=3,
9191
... kind="vectors",
9292
... )
9393
Traceback (most recent call last):
@@ -115,7 +115,7 @@ def _validate_data_input(
115115
GMTInvalidInput
116116
If the data input is not valid.
117117
"""
118-
required_z = required_ncols >= 3
118+
required_z = ncols >= 3
119119
if data is None: # data is None
120120
if x is None and y is None: # both x and y are None
121121
if required_data: # data is not optional

pygmt/src/blockm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _blockm(
5555
with Session() as lib:
5656
with (
5757
lib.virtualfile_in(
58-
check_kind="vector", data=data, x=x, y=y, z=z, required_ncols=3
58+
check_kind="vector", data=data, x=x, y=y, z=z, ncols=3
5959
) as vintbl,
6060
lib.virtualfile_out(kind="dataset", fname=outfile) as vouttbl,
6161
):

pygmt/src/contour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def contour(self, data=None, x=None, y=None, z=None, **kwargs):
145145

146146
with Session() as lib:
147147
with lib.virtualfile_in(
148-
check_kind="vector", data=data, x=x, y=y, z=z, required_ncols=3
148+
check_kind="vector", data=data, x=x, y=y, z=z, ncols=3
149149
) as vintbl:
150150
lib.call_module(
151151
module="contour", args=build_arg_list(kwargs, infile=vintbl)

pygmt/src/nearneighbor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def nearneighbor(
141141
with Session() as lib:
142142
with (
143143
lib.virtualfile_in(
144-
check_kind="vector", data=data, x=x, y=y, z=z, required_ncols=3
144+
check_kind="vector", data=data, x=x, y=y, z=z, ncols=3
145145
) as vintbl,
146146
lib.virtualfile_out(kind="grid", fname=outgrid) as voutgrd,
147147
):

pygmt/src/plot3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,6 @@ def plot3d(
263263
y=y,
264264
z=z,
265265
extra_arrays=extra_arrays,
266-
required_ncols=3,
266+
ncols=3,
267267
) as vintbl:
268268
lib.call_module(module="plot3d", args=build_arg_list(kwargs, infile=vintbl))

pygmt/src/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def project(
245245
x=x,
246246
y=y,
247247
z=z,
248-
required_ncols=2,
248+
ncols=2,
249249
required_data=False,
250250
) as vintbl,
251251
lib.virtualfile_out(kind="dataset", fname=outfile) as vouttbl,

pygmt/src/surface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def surface(
155155
with Session() as lib:
156156
with (
157157
lib.virtualfile_in(
158-
check_kind="vector", data=data, x=x, y=y, z=z, required_ncols=3
158+
check_kind="vector", data=data, x=x, y=y, z=z, ncols=3
159159
) as vintbl,
160160
lib.virtualfile_out(kind="grid", fname=outgrid) as voutgrd,
161161
):

pygmt/src/triangulate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def regular_grid(
138138
with Session() as lib:
139139
with (
140140
lib.virtualfile_in(
141-
check_kind="vector", data=data, x=x, y=y, z=z, required_ncols=2
141+
check_kind="vector", data=data, x=x, y=y, z=z, ncols=2
142142
) as vintbl,
143143
lib.virtualfile_out(kind="grid", fname=outgrid) as voutgrd,
144144
):
@@ -238,7 +238,7 @@ def delaunay_triples(
238238
with Session() as lib:
239239
with (
240240
lib.virtualfile_in(
241-
check_kind="vector", data=data, x=x, y=y, z=z, required_ncols=2
241+
check_kind="vector", data=data, x=x, y=y, z=z, ncols=2
242242
) as vintbl,
243243
lib.virtualfile_out(kind="dataset", fname=outfile) as vouttbl,
244244
):

pygmt/src/wiggle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,6 @@ def wiggle(
108108

109109
with Session() as lib:
110110
with lib.virtualfile_in(
111-
check_kind="vector", data=data, x=x, y=y, z=z, required_ncols=3
111+
check_kind="vector", data=data, x=x, y=y, z=z, ncols=3
112112
) as vintbl:
113113
lib.call_module(module="wiggle", args=build_arg_list(kwargs, infile=vintbl))

0 commit comments

Comments
 (0)