Skip to content

Commit

Permalink
Refactor dimfilter to follow the new coding conventions (GenericMappi…
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman authored and Josh Sixsmith committed Dec 21, 2022
1 parent 5127a89 commit 292207e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pygmt/src/dimfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 292207e

Please sign in to comment.