gmtconvert − Converts, Pastes, and/or Extracts columns from ASCII and binary 1-D tables |
gmtconvert [ inputfiles] [ −A ] [ −E ] [ −Fcols ] [ −H[nrec] ] [ −L ] [ −I ] [ −M[flag] ] [ −N ] [ −S"search string" ] [ −V ] [ −: ] [ −bi[s]n ] [ −bo[s][n] ] [ −f[i|o]colinfo ] |
gmtconvert reads its standard input [or inputfiles] and writes out the desired information to standard output. It can do a combination of three things: (1) convert between binary and ASCII data tables, (2) paste corresponding records from multiple files into a single file, (3) extract a subset of the columns, (4) only extract segments whose header matches a text pattern search, (5) just list all multisegment headers and no data records, and (6) extract first and last data record for each segment. Input (and hence output) may have multiple subheaders if −M is selected, and ASCII tables may have regular headers as well. |
datafile(s) |
ASCII (or binary, see −bi) file(s) holding a number of data columns. |
−A |
The records from the input files should be pAsted horizontally, not appended vertically. [Default processes one file at the time]. Note for binary input, all the files you want to paste must have the same number of columns (as set with −bi). |
||
−E |
Only extract the first and last record for each segment of interest [Default extracts all records]. |
||
−F |
Give a comma-separated list of desired columns or ranges (0 is first column) [Default outputs all columns]. |
||
−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 |
Invert the order of rows, i.e., output the final records in reverse order, starting with the last and ending up with the first input row [Default goes forward]. |
||
−L |
Only output a listing of all multisegment header records and no data records (requires −M and ASCII data). |
||
−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 −bo[s]n must set the number of output columns explicitly. |
||
−N |
Do not write records that only contain NaNs in every field [Default writes all records]. |
||
−S |
Only output those segments whose header record contains the specified text string [Default output all segments]. |
||
−V |
Selects verbose mode, which will send progress reports to stderr [Default runs "silently"]. |
||
−: |
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]. |
||
−bi |
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). |
||
−bo |
Selects binary output. 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). |
||
−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). |
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 convert the binary file test.b (single precision) with 4 columns to ASCII: gmtconvert test.b −bis4 > test.dat To convert the multiple segment ASCII table test.d to a double precision binary file: gmtconvert test.d −M −bo > test.b You have an ASCII table with 6 columns and you want to plot column 5 versus column 0. Try gmtconvert table.d −F5,0 | psxy ... If the file instead is the binary file results.b which has 9 single-precision values per record, we extract the last column and columns 4-6 and write ASCII with the command gmtconvert results.b −F8,4-6 -bi9s | psxy ... You want to plot the 2nd column of the file left.d versus the first column of file right.d: gmtconvert left.d right.d −S −F1,2 | psxy ... To extract all segments in the file big_file.d whose headers contain the string "RIDGE AXIS", try gmtconvert big_file.d −M −S"RIDGE AXIS" > subset.d |