pygmt.grdtrack¶
- 
pygmt.grdtrack(points, grid, newcolname=None, outfile=None, verbose=None, coltypes=None, interpolation=None, **kwargs)[source]¶
- Sample grids at specified (x,y) locations. - Grdtrack reads one or more grid files and a table with (x,y) [or (lon,lat)] positions in the 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 interpolated values added as (one or more) new columns. A bicubic [Default], bilinear, B-spline or nearest-neighbor interpolation is used, requiring boundary conditions at the limits of the region (see - interpolation; Default uses “natural” conditions (second partial derivative normal to edge is zero) unless the grid is automatically recognized as periodic.)- Full option list at https://docs.generic-mapping-tools.org/latest/grdtrack.html - Aliases: - V = verbose 
- f = coltypes 
- n = interpolation 
 - Parameters
- points (str or numpy.ndarray or pandas.DataFrame or xarray.Dataset or geopandas.GeoDataFrame) – Pass in either a file name to an ASCII data table, a 2D - numpy.ndarray, a- pandas.DataFrame, an- xarray.Datasetmade up of 1D- xarray.DataArraydata variables, or a- geopandas.GeoDataFramecontaining the tabular data.
- grid (xarray.DataArray or str) – Gridded array from which to sample values from, or a filename (netcdf format). 
- newcolname (str) – Required if - pointsis a- pandas.DataFrame. The name for the new column in the track- pandas.DataFrametable where the sampled values will be placed.
- outfile (str) – The file name for the output ASCII file. 
- Select verbosity level [Default is w], which modulates the messages written to stderr. Choose among 7 levels of verbosity: - q - Quiet, not even fatal error messages are produced 
- e - Error messages only 
- w - Warnings [Default] 
- t - Timings (report runtimes for time-intensive algorithms); 
- i - Informational messages (same as - verbose=True)
- c - Compatibility warnings 
- d - Debugging messages 
 
- coltypes (str) – [i|o]colinfo. Specify data types of input and/or output columns (time or geographical data). Full documentation is at https://docs.generic-mapping-tools.org/latest/gmt.html#f-full. 
- interpolation (str) – - [b|c|l|n][+a][+bBC][+c][+tthreshold]. Select interpolation mode for grids. You can select the type of spline used: - b for B-spline 
- c for bicubic [Default] 
- l for bilinear 
- n for nearest-neighbor 
 
 
- Returns
- track (pandas.DataFrame or None) – Return type depends on whether the - outfileparameter is set:- pandas.DataFrametable with (x, y, …, newcolname) if- outfileis not set
- None if - outfileis set (track output will be stored in file set by- outfile)
 
 
