Repository navigation
Remove mention of multiple grid inputs in grdtrack docstring - #1345
willschlitzer wants to merge 1 commit into
Conversation
| first two columns (more columns may be present). It interpolates the | ||
| grid(s) at the positions in the table and writes out the table with the | ||
| grid at the positions in the table and writes out the table with the | ||
| interpolated values added as (one or more) new columns. Alternatively |
There was a problem hiding this comment.
Is adding more than one new column possible with a single grid input, which I would assume could happen for a grid input with more than 3 dimensions? Or could this only be the case with multiple grid inputs in a single function?
There was a problem hiding this comment.
One could set crossprofile/-C and get more columns (with just a single grid as input), but this would only work for file outputs, as 3 columns are currently assumed for pandas.DataFrame output (lon, lat, z).
weiji14
left a comment
There was a problem hiding this comment.
Looks like you've stumbled on some limitations of the current pygmt.grdtrack function. Now my question is, do we want to
- Restrict
pygmt.grdtrackto only handle one grid? In which case this documentation PR would make sense, and users working on multiple grids would need to write for-loops or use GMT C instead; or - Add in an enhancement so that
pygmt.grdtrackcan handle multiple grids? Which would be a bit more involved, but is presumably something that needs to be done anyway at some point. Something related to this is the need to handle multiple column outputs as hinted on in #1345 (comment) for people usinggrdtrack -C.
| Sample grids at specified (x,y) locations. | ||
|
|
||
| Reads one or more grid files and a table (from file or an array input; but | ||
| Reads a grid file and a table (from file or an array input; but |
There was a problem hiding this comment.
As grid= can't be repeated in the same function call and it doesn't accept a list of grids, this pull request changes the documentation to state that the grdtrack accepts a single grid.
Technically someone smart enough could figure out that doing grid="grid1.nc -Ggrid2.nc -Ggrid3.nc" would work, but it's more of a hacky solution 🙃
| first two columns (more columns may be present). It interpolates the | ||
| grid(s) at the positions in the table and writes out the table with the | ||
| grid at the positions in the table and writes out the table with the | ||
| interpolated values added as (one or more) new columns. Alternatively |
There was a problem hiding this comment.
One could set crossprofile/-C and get more columns (with just a single grid as input), but this would only work for file outputs, as 3 columns are currently assumed for pandas.DataFrame output (lon, lat, z).
I think option 2 is better. |
While I'm in favor of making this PyGMT module as functionally equivalent to its GMT counterpart as possible, I think these two options are different in scope and not mutually exclusive. I think the documentation should match the capabilities of the current PyGMT module, and can be further updated to reflect when PyGMT's |
|
@weiji14 @meghanrjones Should I close this PR? It looks like you are in favor of modifying |
I agree with your comment about updating the documentation for current usage here, then opening a separate issue/PR for the enhancement. |
maxrjones
left a comment
There was a problem hiding this comment.
I am fine with this intermediate solution, but an enhancement issue should be opened before merging so we do not lose track of the need to add support for multiple inputs.
|
Actually, I just noticed in the gmt docs the -G+llist option. I have not tested if this would work as part of a str argument to the grid parameter in pygmt's grdtrack, but if it does then documenting that option would be a better intermediate solution for multiple grids IMO. |
|
OK so pygmt.grdtrack works with multiple grid inputs but needs some improvements. Here's the test for that case: In python console: So in my opinion two things that need fixing are documenting grid="+lgrids" and updating newcolname to work with multiple column outputs. While I don't think that the |
|
Per @meghanrjones's comment, this change is no longer valid, so I'm closing the PR. |
The documentation for
grdtrackstates that it can accept multiple grid inputs forgrid. Asgrid=can't be repeated in the same function call and it doesn't accept a list of grids, this pull request changes the documentation to state that thegrdtrackaccepts a single grid.Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash commands are:
/format: automatically format and lint the code/test-gmt-dev: run full tests on the latest GMT development version