Skip to content

Commit 330de2d

Browse files
authored
Refactor dimfilter to follow the new coding conventions (#1915)
1 parent 2a3e2bc commit 330de2d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pygmt/src/dimfilter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ def dimfilter(grid, **kwargs):
135135
with Session() as lib:
136136
file_context = lib.virtualfile_from_data(check_kind=None, data=grid)
137137
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)
138+
if (outgrid := kwargs.get("G")) is None:
139+
kwargs["G"] = outgrid = tmpfile.name # output to tmpfile
140+
lib.call_module(
141+
module="dimfilter", args=build_arg_string(kwargs, infile=infile)
142+
)
143143

144144
return load_dataarray(outgrid) if outgrid == tmpfile.name else None

0 commit comments

Comments
 (0)