Skip to content

Commit 4bb2396

Browse files
authored
pygmt.xyz2grd: Rename the parameter 'table' to 'data' (#1545)
Rename the parameter 'table' to 'data' without a deprecation cycle, because the xyz2grd function was added after v0.4.1.
1 parent 047550f commit 4bb2396

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pygmt/src/xyz2grd.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
V="verbose",
2121
)
2222
@kwargs_to_strings(R="sequence")
23-
def xyz2grd(table, **kwargs):
23+
def xyz2grd(data, **kwargs):
2424
"""
2525
Create a grid file from table data.
2626
@@ -33,7 +33,7 @@ def xyz2grd(table, **kwargs):
3333
3434
Parameters
3535
----------
36-
table : str or {table-like}
36+
data : str or {table-like}
3737
Pass in either a file name to an ASCII data table, a 1D/2D
3838
{table-classes}.
3939
@@ -55,7 +55,7 @@ def xyz2grd(table, **kwargs):
5555
"""
5656
with GMTTempFile(suffix=".nc") as tmpfile:
5757
with Session() as lib:
58-
file_context = lib.virtualfile_from_data(check_kind="vector", data=table)
58+
file_context = lib.virtualfile_from_data(check_kind="vector", data=data)
5959
with file_context as infile:
6060
if "G" not in kwargs.keys(): # if outgrid is unset, output to tempfile
6161
kwargs.update({"G": tmpfile.name})

pygmt/tests/test_xyz2grd.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_xyz2grd_input_file():
2323
"""
2424
Run xyz2grd by passing in a filename.
2525
"""
26-
output = xyz2grd(table="@tut_ship.xyz", spacing=5, region=[245, 255, 20, 30])
26+
output = xyz2grd(data="@tut_ship.xyz", spacing=5, region=[245, 255, 20, 30])
2727
assert isinstance(output, xr.DataArray)
2828
assert output.gmt.registration == 0 # Gridline registration
2929
assert output.gmt.gtype == 0 # Cartesian type
@@ -34,7 +34,7 @@ def test_xyz2grd_input_array(ship_data):
3434
"""
3535
Run xyz2grd by passing in a numpy array.
3636
"""
37-
output = xyz2grd(table=np.array(ship_data), spacing=5, region=[245, 255, 20, 30])
37+
output = xyz2grd(data=np.array(ship_data), spacing=5, region=[245, 255, 20, 30])
3838
assert isinstance(output, xr.DataArray)
3939
assert output.gmt.registration == 0 # Gridline registration
4040
assert output.gmt.gtype == 0 # Cartesian type
@@ -45,7 +45,7 @@ def test_xyz2grd_input_df(ship_data):
4545
"""
4646
Run xyz2grd by passing in a data frame.
4747
"""
48-
output = xyz2grd(table=ship_data, spacing=5, region=[245, 255, 20, 30])
48+
output = xyz2grd(data=ship_data, spacing=5, region=[245, 255, 20, 30])
4949
assert isinstance(output, xr.DataArray)
5050
assert output.gmt.registration == 0 # Gridline registration
5151
assert output.gmt.gtype == 0 # Cartesian type
@@ -58,7 +58,7 @@ def test_xyz2grd_input_array_file_out(ship_data):
5858
"""
5959
with GMTTempFile(suffix=".nc") as tmpfile:
6060
result = xyz2grd(
61-
table=np.array(ship_data),
61+
data=np.array(ship_data),
6262
spacing=5,
6363
region=[245, 255, 20, 30],
6464
outgrid=tmpfile.name,

0 commit comments

Comments
 (0)