diff --git a/pygmt/src/grdimage.py b/pygmt/src/grdimage.py index 08d2575f141..8447f133e36 100644 --- a/pygmt/src/grdimage.py +++ b/pygmt/src/grdimage.py @@ -167,7 +167,9 @@ def grdimage(self, grid, **kwargs): with contextlib.ExitStack() as stack: # shading using an xr.DataArray if kwargs.get("I") is not None and data_kind(kwargs["I"]) == "grid": - shading_context = lib.virtualfile_from_grid(kwargs["I"]) + shading_context = lib.virtualfile_from_data( + check_kind="raster", data=kwargs["I"] + ) kwargs["I"] = stack.enter_context(shading_context) fname = stack.enter_context(file_context) diff --git a/pygmt/src/grdview.py b/pygmt/src/grdview.py index e3961e54888..43ad4a2af49 100644 --- a/pygmt/src/grdview.py +++ b/pygmt/src/grdview.py @@ -131,7 +131,9 @@ def grdview(self, grid, **kwargs): drapegrid = kwargs["G"] if data_kind(drapegrid) in ("file", "grid"): if data_kind(drapegrid) == "grid": - drape_context = lib.virtualfile_from_grid(drapegrid) + drape_context = lib.virtualfile_from_data( + check_kind="raster", data=drapegrid + ) kwargs["G"] = stack.enter_context(drape_context) else: raise GMTInvalidInput(