Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pygmt.xyz2grd: Rename the parameter 'table' to 'data' #1545

Merged
merged 1 commit into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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