SPLITXYZ(1)

NAME
splitxyz - filter to divide (x,y,z[,distance,heading]) data into (x,y,z) track segments.

SYNOPSIS
splitxyz [ xyz[dh]file ] -Ccourse_change [ -Aazimuth/tolerance ] [ -Dminimum_distance ] [ -Fxy_filter/z_filter ] [ -Ggap_distance ] [ -H[i][nrec] ] [ -M ] [ -Nnamestem ] [ -Qflags ] [ -S ] [ -V ] [ -Z ] [ -:[i|o] ] [ -b[i|o][s|S|d|D[ncol]|c[var1/...]] ] [ -f[i|o]colinfo ]

DESCRIPTION
splitxyz reads a series of (x,y[,z]) records [or optionally (x,y,z,d,h); see -S option] from standard input [or xyz[dh]file] and splits this into separate lists of (x,y[,z]) series, such that each series has a nearly constant azimuth through the x,y plane. There are options to choose only those series which have a certain orientation, to set a minimum length for series, and to high- or low-pass filter the z values and/or the x,y values. splitxyz is a useful filter between data extraction and pswiggle plotting, and can also be used to divide a large x,y,z dataset into segments. The output is always in the ASCII format; input may be ASCII or binary (see -b).

xyz[dh]file(s)
    3 (but see -Z) [or 5] column ASCII file [or binary, see -b] holding (x,y,z[,d,h]) data values. To use (x,y,z,d,h) input, sorted so that d is non-decreasing, specify the -S option; default expects (x,y,z) only. If no file is specified, splitxyz will read from standard input.

-C  Terminate a segment when a course change exceeding course_change degrees of heading is detected.

OPTIONS

-A  Write out only those segments which are within +/- tolerance degrees of azimuth in heading, measured clockwise from North, [0 - 360]. [Default writes all acceptable segments, regardless of orientation].

-D  Do not write a segment out unless it is at least minimum_distance units long [0]

-F  Filter the z values and/or the x,y values, assuming these are functions of d coordinate. xy_filter and z_filter are filter widths in distance units. If a filter width is zero, the filtering is not performed. The absolute value of the width is the full width of a cosine-arch low-pass filter. If the width is positive, the data are low-pass filtered; if negative, the data are high-pass filtered by subtracting the low-pass value from the observed value. If z_filter is non-zero, the entire series of input z values is filtered before any segmentation is performed, so that the only edge effects in the filtering will happen at the beginning and end of the complete data stream. If xy_filter is non-zero, the data is first divided into segments and then the x,y values of each segment are filtered separately. This may introduce edge effects at the ends of each segment, but prevents a low-pass x,y filter from rounding off the corners of track segments. [Default = no filtering].

-G  Do not let a segment have a gap exceeding gap_distance; instead, split it into two segments. [Default ignores gaps].

-H  Input file(s) has header record(s). If used, the default number of header records is N_HEADER_RECS. Use -Hi if only input data should have header records [Default will write out header records if the input data have them]. Blank lines and lines starting with # are always skipped. Not used with binary data.

-M  Use Map units. Then x,y are in degrees of longitude, latitude, distances are in kilometers, and angles are azimuths. [Default: distances are cartesian in same units as x,y and angles are counter-clockwise from horizontal].

-N  Create Named output files, writing each segment to a separate file in the working directory named namestem.profile#, where # increases consecutively from 1. [Default writes entire output to stdout, separating segments by sub-headings that start with > marks].

-Q  Specify your desired output using any combination of xyzdh, in any order. Do not space between the letters. Use lower case. The output will be ASCII (or binary, see -bo) columns of values corresponding to xyzdh [Default is -Qxyzdh (-Qxydh if -Z is set)].

-S  d and h is supplied. In this case, input contains x,y,z,d,h. [Default expects (x,y,z) input, and d,h are computed from delta x, delta y, according to -M option]

-V  Selects verbose mode, which will send progress reports to stderr [Default runs "silently"].

-Z  Data have x,y only (no z-column).

-:  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 d (double)]. Uppercase S or D will force byte-swapping. Optionally, append ncol, the number of columns in your binary input file if it exceeds the columns needed by the program. Or append c if the input file is netCDF. Optionally, append var1/var2/... to specify the variables to be read. [Default is 2, 3, or 5 input columns as set by -S, -Z].

-bo Selects binary output. Append s for single precision [Default is d (double)]. Uppercase S or D will force byte-swapping. Optionally, append ncol, the number of desired columns in your binary output file. [Default is 1-5 output columns as set by -Q].

-f  Special formatting of input and/or output columns (time or geographical data). Specify i or o to make this apply only to input or output [Default applies to both]. Give one or more columns (or column ranges) separated by commas. Append T (absolute calendar time), t (relative time in chosen TIME_UNIT since 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
Suppose you want to make a wiggle plot of magnetic anomalies on segments oriented approximately east-west from a cruise called cag71 in the region -R300/315/12/20. You want to use a 100km low-pass filter to smooth the tracks and a 500km high-pass filter to detrend the magnetic anomalies. Try this:

gmtlist cag71 -R300/315/12/20 -Fxyzdh | splitxyz -A90/15 -F100/-500 -M -D100 -S -V | pswiggle -R300/315/12/20 -Jm0.6 -Ba5f1:.cag71: -T1 -W0.75p -Ggray -Z200 > cag71_wiggles.ps

MGD-77 users: For this application we recommend that you extract d, h from mgd77list rather than have splitxyz compute them separately.

Suppose you have been given a binary, double-precision file containing lat, lon, gravity values from a survey, and you want to split it into profiles named survey.profile# (when gap exceeds 100 km). Try this:

splitxyz survey.bin -Nsurvey -V -G100 -D100 -: -M -bi3

SEE ALSO
GMT(1), mgd77list(1), pswiggle(1)