Skip to content

pygmt.info: Get information about data tables #4559

Closed

Description

@seisman

This issue serves as the central place for discussing and tracking the implementation of the pygmt.info function in PyGMT. The issue will be closed when the initial implementation is complete. Progress is tracked at PyGMT: Wrapping GMT modules.

Documentation

GMT Option Flags and Modifiers

☑️: Implemented; ⬜: To be implemented/discussed; Strikethrough: Won't implement.

  • ☑️ -C (per_column): Report the min/max values per column in separate output columns.
  • ⬜ -D [dx]: Modifies -I to report the range of each column rounded to the nearest multiple of dx, where each column may have a different increment.
  • ⬜ -E [H|L][col]: Report the record that contains the extreme value (maximum with H, minimum with L) in column col (default is the first column, i.e., 0).
  • ⬜ -F [i|d|t]: Report the number of tables (t), segments (d), or data records (i) in the input.
  • ☑️ -I [b|p|f|s] dx[/dy[...]]: (spacing) Compute the min/max values of the first n columns rounded to the nearest multiple of the provided increments.
  • ⬜ -L: For multiple input files, determine the common region that covers all files; output in the same format as -R.
  • ⬜ -Q: Quick; pass all records through without processing and without checking for bad data records.
  • ⬜ -S [x][y]: Report the mean and standard deviation of x and/or y in addition to the min/max.
  • ☑️ -T dz[+c col]: (nearest_multiple) Report the min/max of the first (or col'th) column to the nearest multiple of dz and output as [zmin, zmax, dz].
  • ☑️ -V (verbose): Verbosity level.
  • -X/-Y: Use Figure.shift_origin instead.
  • ☑️ -a (aspatial): Aspatial column assignment.
  • ⬜ -b: Binary input/output.
  • ⬜ -d: Replace NaN with a specified nodata value on input/output.
  • ⬜ -e: Pattern matching to select input rows.
  • ☑️ -f (coltypes): Column data types.
  • ⬜ -g: Gap detection.
  • ⬜ -h: Read/write header records.
  • ☑️ -i (incols): Select input columns.
  • ⬜ -o: Select output columns.
  • ⬜ -q: Select rows by row number or range.
  • ☑️ -r (registration): Declare the data are node-registered (gridline or pixel).
  • ⬜ -s: Skip rows containing NaN values.
  • ⬜ -w: Wrap repeated cycles.
  • --PAR=value: Use pygmt.config instead.

Notes on Input Formats

  • data: Accepts a file path, 1-D/2-D numpy.ndarray, or pandas.DataFrame.
  • Returns a numpy.ndarray if any of per_column, spacing, or nearest_multiple are set; otherwise returns a str with the raw gmtinfo output.
  • When spacing is set, the output is in the form [w, e, s, n], suitable for use as the region parameter in other functions.
  • When nearest_multiple is set, the output is in the form [zmin, zmax, dz], suitable for use as the series parameter in pygmt.makecpt.

Linked Pull Requests

Related Issues and Discussions

  • pygmt.info is commonly used to determine the region argument for other PyGMT functions by rounding data bounds to a convenient multiple via spacing.
  • The nearest_multiple output is the natural input for pygmt.makecpt's series parameter.
  • For grid data, use pygmt.grdinfo instead, which reports similar statistics for 2-D grids.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature request

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions