Skip to content

Commit fb43d6f

Browse files
Apply suggestions from code review
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
1 parent 25cad5e commit fb43d6f

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

pygmt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
grdtrack,
4848
info,
4949
makecpt,
50-
sphinterpolate,
5150
sphdistance,
51+
sphinterpolate,
5252
surface,
5353
which,
5454
x2sys_cross,

pygmt/src/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
from pygmt.src.plot3d import plot3d
3636
from pygmt.src.rose import rose
3737
from pygmt.src.solar import solar
38-
from pygmt.src.sphinterpolate import sphinterpolate
3938
from pygmt.src.sphdistance import sphdistance
39+
from pygmt.src.sphinterpolate import sphinterpolate
4040
from pygmt.src.subplot import set_panel, subplot
4141
from pygmt.src.surface import surface
4242
from pygmt.src.text import text_ as text # "text" is an argument within "text_"

pygmt/src/sphinterpolate.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
V="verbose",
2222
)
2323
@kwargs_to_strings(I="sequence", R="sequence")
24-
def sphinterpolate(table, **kwargs):
24+
def sphinterpolate(data, **kwargs):
2525
r"""
2626
Create spherical grid files in tension of data.
2727
@@ -36,7 +36,7 @@ def sphinterpolate(table, **kwargs):
3636
3737
Parameters
3838
----------
39-
table : str or {table-like}
39+
data : str or {table-like}
4040
Pass in (x, y, z) or (longitude, latitude, elevation) values by
4141
providing a file name to an ASCII data table, a 2D
4242
{table-classes}.
@@ -58,13 +58,12 @@ def sphinterpolate(table, **kwargs):
5858
"""
5959
with GMTTempFile(suffix=".nc") as tmpfile:
6060
with Session() as lib:
61-
file_context = lib.virtualfile_from_data(check_kind="vector", data=table)
61+
file_context = lib.virtualfile_from_data(check_kind="vector", data=data)
6262
with file_context as infile:
6363
if "G" not in kwargs.keys(): # if outgrid is unset, output to tempfile
6464
kwargs.update({"G": tmpfile.name})
6565
outgrid = kwargs["G"]
66-
arg_str = build_arg_string(kwargs)
67-
arg_str = " ".join([infile, arg_str])
66+
arg_str = " ".join([infile, build_arg_string(kwargs)])
6867
lib.call_module("sphinterpolate", arg_str)
6968

7069
return load_dataarray(outgrid) if outgrid == tmpfile.name else None

pygmt/tests/test_sphinterpolate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def test_sphinterpolate_outgrid():
1414
"""
1515
with GMTTempFile(suffix=".nc") as tmpfile:
1616
result = sphinterpolate(
17-
table="@mars370d.txt", outgrid=tmpfile.name, spacing=1, region="g"
17+
data="@mars370d.txt", outgrid=tmpfile.name, spacing=1, region="g"
1818
)
1919
assert result is None # return value is None
2020
assert os.path.exists(path=tmpfile.name) # check that outgrid exists
@@ -24,7 +24,7 @@ def test_sphinterpolate_no_outgrid():
2424
"""
2525
Test sphinterpolate with no set outgrid.
2626
"""
27-
temp_grid = sphinterpolate(table="@mars370d.txt", spacing=1, region="g")
27+
temp_grid = sphinterpolate(data="@mars370d.txt", spacing=1, region="g")
2828
assert temp_grid.dims == ("lat", "lon")
2929
assert temp_grid.gmt.gtype == 1 # Geographic grid
3030
assert temp_grid.gmt.registration == 0 # Gridline registration

0 commit comments

Comments
 (0)