Skip to content

Commit d00d347

Browse files
committed
Rename the parameter 'table' to 'data'
As per #1479.
1 parent c90f27c commit d00d347

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

pygmt/src/triangulate.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
r="registration",
3131
)
3232
@kwargs_to_strings(R="sequence")
33-
def triangulate(table=None, x=None, y=None, z=None, **kwargs):
33+
def triangulate(data=None, x=None, y=None, z=None, **kwargs):
3434
"""
3535
Delaunay triangulation or Voronoi partitioning and gridding of Cartesian
3636
data.
@@ -41,7 +41,7 @@ def triangulate(table=None, x=None, y=None, z=None, **kwargs):
4141
and *projection*) is chosen then it is applied before the triangulation
4242
is calculated.
4343
44-
Must provide either ``table`` or ``x``, ``y``, and ``z``.
44+
Must provide either ``data`` or ``x``, ``y``, and ``z``.
4545
4646
Full option list at :gmt-docs:`triangulate.html`
4747
@@ -51,7 +51,7 @@ def triangulate(table=None, x=None, y=None, z=None, **kwargs):
5151
----------
5252
x/y/z : np.ndarray
5353
Arrays of x and y coordinates and values z of the data points.
54-
table : str or {table-like}
54+
data : str or {table-like}
5555
Pass in (x, y, z) or (longitude, latitude, elevation) values by
5656
providing a file name to an ASCII data table, a 2D
5757
{table-classes}.
@@ -89,7 +89,7 @@ def triangulate(table=None, x=None, y=None, z=None, **kwargs):
8989
with Session() as lib:
9090
# Choose how data will be passed into the module
9191
table_context = lib.virtualfile_from_data(
92-
check_kind="vector", data=table, x=x, y=y, z=z
92+
check_kind="vector", data=data, x=x, y=y, z=z
9393
)
9494
with table_context as infile:
9595
if "G" not in kwargs: # table output if outgrid is unset

pygmt/tests/test_triangulate.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_triangulate_input_file():
2424
"""
2525
Run triangulate by passing in a filename.
2626
"""
27-
output = triangulate(table="@tut_ship.xyz")
27+
output = triangulate(data="@tut_ship.xyz")
2828
assert isinstance(output, pd.DataFrame)
2929
assert output.shape == (161935, 3)
3030

@@ -34,7 +34,7 @@ def test_triangulate_input_data_array(dataframe):
3434
Run triangulate by passing in a numpy array into data.
3535
"""
3636
data = dataframe.to_numpy()
37-
output = triangulate(table=data)
37+
output = triangulate(data=data)
3838
assert isinstance(output, pd.DataFrame)
3939
assert output.shape == (161935, 3)
4040

@@ -68,7 +68,7 @@ def test_triangulate_wrong_kind_of_input(dataframe):
6868
data = dataframe.bathymetry.to_xarray() # convert pandas.Series to xarray.DataArray
6969
assert data_kind(data) == "grid"
7070
with pytest.raises(GMTInvalidInput):
71-
triangulate(table=data)
71+
triangulate(data=data)
7272

7373

7474
def test_triangulate_with_outgrid_true(dataframe):
@@ -77,7 +77,7 @@ def test_triangulate_with_outgrid_true(dataframe):
7777
"""
7878
data = dataframe.to_numpy()
7979
output = triangulate(
80-
table=data, spacing="5m", region=[245, 255, 20, 30], outgrid=True
80+
data=data, spacing="5m", region=[245, 255, 20, 30], outgrid=True
8181
)
8282
assert isinstance(output, xr.DataArray)
8383
assert output.shape == (121, 121)
@@ -90,7 +90,7 @@ def test_triangulate_with_outgrid_param(dataframe):
9090
data = dataframe.to_numpy()
9191
with GMTTempFile(suffix=".nc") as tmpfile:
9292
output = triangulate(
93-
table=data, spacing="5m", region=[245, 255, 20, 30], outgrid=tmpfile.name
93+
data=data, spacing="5m", region=[245, 255, 20, 30], outgrid=tmpfile.name
9494
)
9595
assert output is None # check that output is None since outgrid is set
9696
assert os.path.exists(path=tmpfile.name) # check that outgrid exists

0 commit comments

Comments
 (0)