Skip to content

Commit 906bb86

Browse files
authored
Refactor grdview and grdimage to use virtualfile_from_data (#1988)
1 parent c1cfaac commit 906bb86

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pygmt/src/grdimage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ def grdimage(self, grid, **kwargs):
167167
with contextlib.ExitStack() as stack:
168168
# shading using an xr.DataArray
169169
if kwargs.get("I") is not None and data_kind(kwargs["I"]) == "grid":
170-
shading_context = lib.virtualfile_from_grid(kwargs["I"])
170+
shading_context = lib.virtualfile_from_data(
171+
check_kind="raster", data=kwargs["I"]
172+
)
171173
kwargs["I"] = stack.enter_context(shading_context)
172174

173175
fname = stack.enter_context(file_context)

pygmt/src/grdview.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ def grdview(self, grid, **kwargs):
131131
drapegrid = kwargs["G"]
132132
if data_kind(drapegrid) in ("file", "grid"):
133133
if data_kind(drapegrid) == "grid":
134-
drape_context = lib.virtualfile_from_grid(drapegrid)
134+
drape_context = lib.virtualfile_from_data(
135+
check_kind="raster", data=drapegrid
136+
)
135137
kwargs["G"] = stack.enter_context(drape_context)
136138
else:
137139
raise GMTInvalidInput(

0 commit comments

Comments
 (0)