From 9cd8610651c9cd65c5059d920608d6f88ab170cf Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 4 May 2022 15:42:41 +0800 Subject: [PATCH] Refactor dimfilter to follow the new coding conventions --- pygmt/src/dimfilter.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pygmt/src/dimfilter.py b/pygmt/src/dimfilter.py index 8259955bff8..b618172a3f2 100644 --- a/pygmt/src/dimfilter.py +++ b/pygmt/src/dimfilter.py @@ -135,10 +135,10 @@ def dimfilter(grid, **kwargs): with Session() as lib: file_context = lib.virtualfile_from_data(check_kind=None, data=grid) with file_context as infile: - if "G" not in kwargs: # if outgrid is unset, output to tempfile - kwargs.update({"G": tmpfile.name}) - outgrid = kwargs["G"] - arg_str = " ".join([infile, build_arg_string(kwargs)]) - 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) + ) return load_dataarray(outgrid) if outgrid == tmpfile.name else None