Skip to content

Commit d3a4f38

Browse files
Merge branch 'master' into log-power-proj
2 parents 3fa6f27 + 600d9ae commit d3a4f38

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pygmt/base_plotting.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,18 +598,17 @@ def grdview(self, grid, **kwargs):
598598
raise GMTInvalidInput(f"Unrecognized data type for grid: {type(grid)}")
599599

600600
with contextlib.ExitStack() as stack:
601-
fname = stack.enter_context(file_context)
602-
if "G" in kwargs:
601+
if "G" in kwargs: # deal with kwargs["G"] if drapegrid is xr.DataArray
603602
drapegrid = kwargs["G"]
604603
if data_kind(drapegrid) in ("file", "grid"):
605604
if data_kind(drapegrid) == "grid":
606605
drape_context = lib.virtualfile_from_grid(drapegrid)
607-
drapefile = stack.enter_context(drape_context)
608-
kwargs["G"] = drapefile
606+
kwargs["G"] = stack.enter_context(drape_context)
609607
else:
610608
raise GMTInvalidInput(
611609
f"Unrecognized data type for drapegrid: {type(drapegrid)}"
612610
)
611+
fname = stack.enter_context(file_context)
613612
arg_str = " ".join([fname, build_arg_string(kwargs)])
614613
lib.call_module("grdview", arg_str)
615614

0 commit comments

Comments
 (0)