pygmt.grdinfo

pygmt.grdinfo(grid, **kwargs)[source]

Get information about a grid.

Can read the grid from a file or given as an xarray.DataArray grid.

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

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

  • region (str or list) – Required if this is the first plot command. 'xmin/xmax/ymin/ymax[+r][+uunit]'. Specify the region of interest.

  • per_column (str or bool) – n|t Formats the report using tab-separated fields on a single line. The output is name w e s n z0 z1 dx dy nx ny[ x0 y0 x1 y1 ] [ med scale ] [mean std rms] [n_nan] registration gtype. The data in brackets are outputted depending on the zdata and zextremes arguments. Use t to place file name at the end of the output record or, n or True to only output numerical columns. The registration is either 0 (gridline) or 1 (pixel), while gtype is either 0 (Cartesian) or 1 (geographic). The default value is False. This cannot be called if geographic is also set.

  • tiles (str) – xoff[/yoff][+i] Divide a single grid’s domain (or the regio``n domain, if no grid given) into tiles of size dx times dy (set via ``spacing). You can specify overlap between tiles by appending xoff[/yoff]. If the single grid is given you may use the modifier +i to ignore tiles that have no data within each tile subregion. Default output is text region strings. Use per_column to instead report four columns with xmin xmax ymin ymax per tile, or use per_column=t to also have the region string appended as trailing text.

  • geographic (bool) – Report grid domain and x/y-increments in world mapping format The default value is False. This cannot be called if tab is also set.

  • force_scan (int or str) – 0|1|2|p|a 0: Report range of z after actually scanning the data, not just reporting what the header says. 1: Report median and L1 scale of z (L1 scale = 1.4826 * Median Absolute Deviation (MAD)). 2: Report mean, standard deviation, and root-mean-square (rms) of z. p: Report mode (LMS) and LMS scale of z. a: Include all of the above.

  • minxmax_pos (bool) – Include the x/y values at the location of the minimum and maximum z-values.

  • verbose (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 algorthms);

    • i - Informational messages (same as “verbose=True”)

    • c - Compatibility warnings

    • d - Debugging messages

Returns

info (str) – A string with information about the grid.