We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a3e2bc commit 330de2dCopy full SHA for 330de2d
pygmt/src/dimfilter.py
@@ -135,10 +135,10 @@ def dimfilter(grid, **kwargs):
135
with Session() as lib:
136
file_context = lib.virtualfile_from_data(check_kind=None, data=grid)
137
with file_context as infile:
138
- if "G" not in kwargs: # if outgrid is unset, output to tempfile
139
- kwargs.update({"G": tmpfile.name})
140
- outgrid = kwargs["G"]
141
- arg_str = " ".join([infile, build_arg_string(kwargs)])
142
- lib.call_module(module="dimfilter", args=arg_str)
+ if (outgrid := kwargs.get("G")) is None:
+ kwargs["G"] = outgrid = tmpfile.name # output to tmpfile
+ lib.call_module(
+ module="dimfilter", args=build_arg_string(kwargs, infile=infile)
+ )
143
144
return load_dataarray(outgrid) if outgrid == tmpfile.name else None
0 commit comments