pygmt.grd2xyz

pygmt.grd2xyz(grid, output_type='pandas', outfile=None, *, region=None, verbose=None, **kwargs)[source]

Convert grid to data table.

Read a grid and output xyz-triplets as a numpy.ndarray, pandas.DataFrame, or ASCII file.

Full option list at https://docs.generic-mapping-tools.org/latest/grd2xyz.html

Aliases:

  • R = region

  • V = verbose

Parameters
  • grid (str or xarray.DataArray) – The file name of the input grid or the grid loaded as a xarray.DataArray. This is the only required parameter.

  • output_type (str) –

    Determine the format the xyz data will be returned in [Default is pandas]:

  • outfile (str) – The file name for the output ASCII file.

  • region (str or list) – Required if this is the first plot command. xmin/xmax/ymin/ymax[+r][+uunit]. Specify the region of interest. Adding region will select a subsection of the grid. If this subsection exceeds the boundaries of the grid, only the common region will be output.

  • verbose (bool or str) –

    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

Returns

ret (pandas.DataFrame or numpy.ndarray or None) – Return type depends on outfile and output_type: