minmax − Find extreme values in data tables


minmax [ files] [ −C ] [ −D ] [ −EL|l|H|hcol ] [ −H[nrec] ] [ −Idx[/dy[/dz...] ] [ −M[flag] ] [ −Tdz ] [ −: ] [ −bi[s][n] ] [ −f[i|o]colinfo ]


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.


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



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


Sets longitude discontinuity to the Dateline (-180/+180) [Default is Greenwich (0-360)]. Requires −L.


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.


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].


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.


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 −bo[s]n must set the number of output columns explicitly.


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.


Selects binary input. Append s for single precision [Default is double]. Uppercase S (or D) will force byte-swapping. Append n for the number of columns in the binary file(s). [Default is 2 input columns].


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).


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.


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

psxyminmax −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