Skip to content

Commit

Permalink
Fix the spacing parameter and check required parameters in xyz2grd
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Mar 11, 2022
1 parent fc352ca commit 817fc50
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pygmt/src/xyz2grd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
xyz2grd - Convert data table to a grid.
"""
from pygmt.clib import Session
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers import (
GMTTempFile,
build_arg_string,
Expand Down Expand Up @@ -30,7 +31,7 @@
r="registration",
w="wrap",
)
@kwargs_to_strings(R="sequence")
@kwargs_to_strings(I="sequence", R="sequence")
def xyz2grd(data=None, x=None, y=None, z=None, **kwargs):
r"""
Create a grid file from table data.
Expand Down Expand Up @@ -132,6 +133,9 @@ def xyz2grd(data=None, x=None, y=None, z=None, **kwargs):
- None if ``outgrid`` is set (grid output will be stored in file set by
``outgrid``)
"""
if "I" not in kwargs or "R" not in kwargs:
raise GMTInvalidInput("Both 'region' and 'spacing' must be specified.")

with GMTTempFile(suffix=".nc") as tmpfile:
with Session() as lib:
file_context = lib.virtualfile_from_data(
Expand Down

0 comments on commit 817fc50

Please sign in to comment.