Skip to content

Commit

Permalink
pygmt.xyz2grd: Rename the parameter 'table' to 'data' (GenericMapping…
Browse files Browse the repository at this point in the history
…Tools#1545)

Rename the parameter 'table' to 'data' without a deprecation cycle,
because the xyz2grd function was added after v0.4.1.
  • Loading branch information
seisman authored and Josh Sixsmith committed Dec 21, 2022
1 parent 8a531ba commit 956d9af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pygmt/src/xyz2grd.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
V="verbose",
)
@kwargs_to_strings(R="sequence")
def xyz2grd(table, **kwargs):
def xyz2grd(data, **kwargs):
"""
Create a grid file from table data.
Expand All @@ -33,7 +33,7 @@ def xyz2grd(table, **kwargs):
Parameters
----------
table : str or {table-like}
data : str or {table-like}
Pass in either a file name to an ASCII data table, a 1D/2D
{table-classes}.
Expand All @@ -55,7 +55,7 @@ def xyz2grd(table, **kwargs):
"""
with GMTTempFile(suffix=".nc") as tmpfile:
with Session() as lib:
file_context = lib.virtualfile_from_data(check_kind="vector", data=table)
file_context = lib.virtualfile_from_data(check_kind="vector", data=data)
with file_context as infile:
if "G" not in kwargs.keys(): # if outgrid is unset, output to tempfile
kwargs.update({"G": tmpfile.name})
Expand Down
8 changes: 4 additions & 4 deletions pygmt/tests/test_xyz2grd.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_xyz2grd_input_file():
"""
Run xyz2grd by passing in a filename.
"""
output = xyz2grd(table="@tut_ship.xyz", spacing=5, region=[245, 255, 20, 30])
output = xyz2grd(data="@tut_ship.xyz", spacing=5, region=[245, 255, 20, 30])
assert isinstance(output, xr.DataArray)
assert output.gmt.registration == 0 # Gridline registration
assert output.gmt.gtype == 0 # Cartesian type
Expand All @@ -34,7 +34,7 @@ def test_xyz2grd_input_array(ship_data):
"""
Run xyz2grd by passing in a numpy array.
"""
output = xyz2grd(table=np.array(ship_data), spacing=5, region=[245, 255, 20, 30])
output = xyz2grd(data=np.array(ship_data), spacing=5, region=[245, 255, 20, 30])
assert isinstance(output, xr.DataArray)
assert output.gmt.registration == 0 # Gridline registration
assert output.gmt.gtype == 0 # Cartesian type
Expand All @@ -45,7 +45,7 @@ def test_xyz2grd_input_df(ship_data):
"""
Run xyz2grd by passing in a data frame.
"""
output = xyz2grd(table=ship_data, spacing=5, region=[245, 255, 20, 30])
output = xyz2grd(data=ship_data, spacing=5, region=[245, 255, 20, 30])
assert isinstance(output, xr.DataArray)
assert output.gmt.registration == 0 # Gridline registration
assert output.gmt.gtype == 0 # Cartesian type
Expand All @@ -58,7 +58,7 @@ def test_xyz2grd_input_array_file_out(ship_data):
"""
with GMTTempFile(suffix=".nc") as tmpfile:
result = xyz2grd(
table=np.array(ship_data),
data=np.array(ship_data),
spacing=5,
region=[245, 255, 20, 30],
outgrid=tmpfile.name,
Expand Down

0 comments on commit 956d9af

Please sign in to comment.