Description
Description of the desired feature
Implement grdtrack
which "Sample grids at specified (x,y) locations". Continuing to add data processing functionality to pygmt
following my earlier work on #245.
The grdtrack
function belongs to the "Sampling of 1-D and 2-D Data" family of functions in GMT (see module quickref). It is slightly tricky to implement as it takes 2 input files (a table and a grid), but is nevertheless useful for people working on stuff like radar or laser altimetry, as mentioned by @steo85it in https://gitter.im/GenericMappingTools/pygmt?at=5c89603a8f294b134a38ed82.
Notes
- May want to future proof the code to share it with other sampling functions like
sample1d
,grdsample
, etc. - Test cases will require new sample datasets.
hawaii_topo.nc
would be nice but I can't find it, so I'm suggesting@ridge.txt
and@spac_33.nc
used in https://gmt.soest.hawaii.edu/doc/latest/gallery/ex33.html. - Handle I/O better, as mentioned here. Should we separate data reading/writing from data processing? I.e. have pygmt function running only on pandas tables, xarray grids.
Idea for structure
Store the grdtrack
function under sampling.py
. Similar to how e.g. surface
is under gridding.py
.
# File at gmt/sampling.py
"""
GMT modules for Sampling of 1-D and 2-D Data
"""
def grdtrack(table: pd.DataFrame, grid: xr.DataArray, **kwargs):
Are you willing to help implement and maintain this feature? Yes