Skip to content

Commit 817fc50

Browse files
committed
Fix the spacing parameter and check required parameters in xyz2grd
1 parent fc352ca commit 817fc50

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pygmt/src/xyz2grd.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
xyz2grd - Convert data table to a grid.
33
"""
44
from pygmt.clib import Session
5+
from pygmt.exceptions import GMTInvalidInput
56
from pygmt.helpers import (
67
GMTTempFile,
78
build_arg_string,
@@ -30,7 +31,7 @@
3031
r="registration",
3132
w="wrap",
3233
)
33-
@kwargs_to_strings(R="sequence")
34+
@kwargs_to_strings(I="sequence", R="sequence")
3435
def xyz2grd(data=None, x=None, y=None, z=None, **kwargs):
3536
r"""
3637
Create a grid file from table data.
@@ -132,6 +133,9 @@ def xyz2grd(data=None, x=None, y=None, z=None, **kwargs):
132133
- None if ``outgrid`` is set (grid output will be stored in file set by
133134
``outgrid``)
134135
"""
136+
if "I" not in kwargs or "R" not in kwargs:
137+
raise GMTInvalidInput("Both 'region' and 'spacing' must be specified.")
138+
135139
with GMTTempFile(suffix=".nc") as tmpfile:
136140
with Session() as lib:
137141
file_context = lib.virtualfile_from_data(

0 commit comments

Comments
 (0)