pygmt
pygmt copied to clipboard
Improve input/output options for blockm* and grdtrack
Description of the desired feature
Originally posted by @weiji14 in https://github.com/GenericMappingTools/pygmt/pull/1092#discussion_r598541899
- [x] Improve the input options for blockmedian, blockmode, and blockmean from only supporting pandas.DataFrame or file to supporting a file, matrix, pandas.DataFrame, or x/y/z.
- [ ] Improve the output options to support pandas.DataFrame or a file, independent of the input choice (current implementation requires
outfileif a data file is provided as the input).
Are you willing to help implement and maintain this feature? Yes
I'll take the blame for this one. Just for context, the " pd.DataFrame in, pd.DataFrame out; filename in, filename out" restriction was added in a37fb0aa3fef025eb1c723039060caa0489fcab1 when I was wrapping the grdtrack function at #308. Some of the blockmedian code was based on grdtrack, and was not really questioned ever since.
So we should also update the grdtrack code as well to have the same I/O design. I actually had a friend using grdtrack last week who would have loved to have file-in and pandas.DataFrame-out for grdtrack so I'll work on refactoring grdtrack while @meghanrjones can work on the blockm* I/O refactor.
@weiji14, do you mind if I work on a PR for x/y input for grdtrack?
Just an update - I will hold off until after https://github.com/GenericMappingTools/pygmt/pull/1353 and https://github.com/GenericMappingTools/pygmt/pull/1336 are completed to submit the x/y input PR for grdtrack.
The issue will be tracked in #2731 and #1318. Closing.