-
Notifications
You must be signed in to change notification settings - Fork 239
Description
Originally posted by @weiji14 in #1284 (comment):
Currently, the blockm*/grdtrack modules simply outputs pandas.DataFrame/filenames (see #1099) automatically depending on the input type (2 options). The implementation @willschlitzer made at bf58dc2 and 68fab7c returns either numpy/pandas/str depending on the user input (3 options). Best to be consistent across PyGMT on the types of outputs users can expect.
I am opening this issue to find out what the output format/options should be with the additional of x/y/z in blockmean, blockmedian, and grdtrack, as well as for new methods such as grd2xyz.
Edit by @seisman on Oct 9, 2023:
The PyGMT team has reach an agreement that PyGMT functions/methods should have consistent behavior for table-like outputs, i.e., the output depends on the output_type parameter.
Valid output_type values are:
file: output to a file directly (usually need to setoutfile)numpy: return a NumPy array (may not always possible because data must be in the same dtype in a 2-D numpy array)pandas: return a pandas.DataFrame (sometimes need to setnewcolname)
Here are a list of functions/methods that have table-like outputs:
-
blockm*pygmt.blockm*: Add 'output_type' parameter for output in pandas/numpy/file formats #3103 -
filter1dpygmt.filter1d: Improve performance by storing output in virtual files #3085 -
grdinfo[Will be tracked in Better return values for grdinfo #593] -
grdtrackpygmt.grdtrack: Add 'output_type' parameter for output in pandas/numpy/file formats #3106 -
triangulatepygmt.triangulate.delaunay_triples: Improve performance by storing output in virtual files #3107 -
grdvolumepygmt.grdvolume: Refactor to store output in virtual files instead of temporary files #3102 -
selectpygmt.select: Improve performance by storing output in virtual files #3108 -
which[Will be tracked in pygmt.which: Find full path to specified files #3003] -
grdhisteqpygmt.grdhisteq.compute_bins: Refactor to store output in virtual files instead of temporary files #3109 -
x2sys_cross[Will be tracked in x2sys_cross: Refactor to get rid of temporary files and have consistent table-like output behavior #3160] -
info[Will be tracked in Better return value for pygmt.info #3159] -
projectpygmt.project: Add 'output_type' parameter for output in pandas/numpy/file formats #3110 -
grd2xyzpygmt.grd2xyz: Improve performance by storing output in virtual files #3097
We need to make sure they behave consistently.