You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The block of code below is currently used seven times throughout PyGMT modules (probably more pending Will's PRs). Based on GenericMappingTools/gmt#5563 (comment), it may need to be used up to 34 times if we continue adding functions 1:1 with GMT modules. I think it would be useful to add an build_outgrid_args() method (or something similar) that can be used throughout to build the argument string using either outgrid or tempfile.name. I expect this would be simplest to implement as a new method in the Session class, although it could be a function in utils.
Edit: The original post only mentioned managing the input arguments to call_module, but the same can be applied to the output for the current default behavior of returning a DataArray if outgrid is not set:
Yes, probably best to standardize this chunk if it's going to be used up to 34 times (!!!). Personally I wouldn't hide away the if "G" not in kwargs.keys(): since there might be extra logic involved, e.g. at
But certainly for the latter if outgrid == tmpfile.name block, we can have a function producing the correct output grid format. This can be called in a PyGMT module at the end using return some_grid_function_name(result). Maybe start a new pygmt/io.py file to put all of PyGMT's Input/Output logic? Will tie in nicely with the table-output discussion happening at #1318, and could also be a good place longer-term to add in logic for the expanding variety of PyGMT input formats (xref #949).
Description of the desired feature
The block of code below is currently used seven times throughout PyGMT modules (probably more pending Will's PRs). Based on GenericMappingTools/gmt#5563 (comment), it may need to be used up to 34 times if we continue adding functions 1:1 with GMT modules. I think it would be useful to add an
build_outgrid_args()
method (or something similar) that can be used throughout to build the argument string using either outgrid or tempfile.name. I expect this would be simplest to implement as a new method in the Session class, although it could be a function in utils.pygmt/pygmt/src/grdclip.py
Lines 85 to 88 in 6a4b871
Edit: The original post only mentioned managing the input arguments to call_module, but the same can be applied to the output for the current default behavior of returning a DataArray if outgrid is not set:
pygmt/pygmt/src/grdclip.py
Lines 91 to 96 in 6a4b871
Are you willing to help implement and maintain this feature? Yes
The text was updated successfully, but these errors were encountered: