MINMAX(1)

NAME
minmax - Find extreme values in data tables

SYNOPSIS
minmax [ files] [ -C ] [ -EL|l|H|hcol ] [ -H[i][nrec] ] [ -Idx[/dy[/dz...] ] [ -M[flag] ] [ -Tdz ] [ -:[i|o] ] [ -bi[s|S|d|D][ncol] ] [ -f[i|o]colinfo ]

DESCRIPTION
minmax reads its standard input [or from files] and finds the extreme values in each of the columns. It recognizes NaNs and will print warnings if the number of columns vary from record to record. As an option, minmax will find the extent of the first n columns rounded up and down to the nearest multiple of the supplied increments. By default, this output will be in the form -Rw/e/s/n which can be used directly in the command line for other programs (hence only dx and dy are neede), or the output will be in column form for as many columns as there are increments provided. A similar option (-T) will provide a -Tzmin/zmax/dz string for makecpt.

xyzfile
    ASCII [or binary, see -b] file(s) holding a fixed number of data columns.

OPTIONS

-C  Report the min/max values per column in separate columns [Default uses <min/max> format].

-E  Returns the record whose column col contains the minimum (l) or maximum (h) value. Upper case (L|H) works on absolute value of the data. In case of multiple matches, only the first record is returned.

-H  Input file(s) has Header record(s). Number of header records can be changed by editing your .gmtdefaults4 file. If used, GMT default is 1 header record. Use -Hi if only input data should have header records [Default will write out header records if the input data have them].

-I  Report the min/max of the first n columns to the nearest multiple of the provided increments (separate the n increments by slashes), and output results in the form -Rw/e/s/n (unless -C is set). If only one increment is given we also use it for the second column (for backwards compatibility). To override this behaviour, use -Ipdx.

-M  Multiple segment file(s). Segments are separated by a special record. For ASCII files the first character must be flag [Default is '>']. For binary files all fields must be NaN and -b must set the number of output columns explicitly. By default the -M setting applies to both input and output. Use -Mi and -Mo to give separate settings.

-T  Report the min/max of the first column to the nearest multiple of dz and output this in the form -Tzmin/zmax/dz.

-:  Toggles between (longitude,latitude) and (latitude,longitude) input and/or output. [Default is (longitude,latitude)]. Append i to select input only or o to select output only. [Default affects both]. Only works when -I is selected.

-bi Selects binary input. Append s for single precision [Default is d (double)]. Uppercase S (or D) will force byte-swapping. Optionally, append ncol, the number of columns in your binary file if it exceeds the columns needed by the program. [Default is 2 input columns].

-f  Special formatting of input and output columns (time or geographical data). Specify i(nput) or o(utput) [Default is both input and output]. Give one or more columns (or column ranges) separated by commas. Append T (Absolute calendar time), t (time relative to chosen TIME_EPOCH), x (longitude), y (latitude), or f (floating point) to each column or column range item. Shorthand -f[i|o]g means -f[i|o]0x,1y (geographic coordinates).

ASCII FORMAT PRECISION
The ASCII output formats of numerical data are controlled by parameters in your .gmtdefaults4 file. Longitude and latitude are formatted according to OUTPUT_DEGREE_FORMAT, whereas other values are formatted according to D_FORMAT. Be aware that the format in effect can lead to loss of precision in the output, which can lead to various problems downstream. If you find the output is not written with enough precision, consider switching to binary output (-bo if available) or specify more decimals using the D_FORMAT setting.

EXAMPLES
To find the extreme values in the file ship_gravity.xygd:

minmax ship_gravity.xygd

Output should look like

ship_gravity.xygd: N = 6992 <326.125/334.684> <-28.0711/-8.6837> <-47.7/177.6> <0.6/3544.9>

To find the extreme values in the file track.xy to the nearest 5 units and use this region to draw a line using psxy, run

psxy `minmax -I5 track.xy` track.xy -Jx1 -B5 -P > track.ps

To find the min and max values for each of the first 4 columns, but rounded to integers, use

minmax junkfile -C -I1/1/1/1

SEE ALSO
GMT(1)