Provided by: gmt_4.5.11-1build1_amd64

**NAME**

spectrum1d - compute auto- [and cross- ] spectra from one [or two] timeseries.

**SYNOPSIS**

spectrum1d[x[y]file]-Ssegment_size] [-C[xycnpago] ] [-Ddt] [-Nname_stem] [-V] [-W] [-b[i|o][s|S|d|D[ncol]|c[var1/...]] ] [-f[i|o]colinfo]

**DESCRIPTION**

spectrum1dreads X [and Y] values from the first [and second] columns on standard input [orx[y]file]. These values are treated as timeseries X(t) [Y(t)] sampled at equal intervals spaceddtunits apart. There may be any number of lines of input.spectrum1dwill create file[s] containing auto- [and cross- ] spectral density estimates by Welch's method of ensemble averaging of multiple overlapped windows, using standard error estimates from Bendat and Piersol. The output files have 3 columns: f or w, p, and e. f or w is the frequency or wavelength, p is the spectral density estimate, and e is the one standard deviation error bar size. These files are named based onname_stem. If the-Coption is used, up to eight files are created; otherwise only one (xpower) is written. The files (which are ASCII unless-bois set) are as follows:name_stem.xpower Power spectral density of X(t). Units of X * X *dt.name_stem.ypower Power spectral density of Y(t). Units of Y * Y *dt.name_stem.cpower Power spectral density of the coherent output. Units same as ypower.name_stem.npower Power spectral density of the noise output. Units same as ypower.name_stem.gain Gain spectrum, or modulus of the transfer function. Units of (Y / X).name_stem.phase Phase spectrum, or phase of the transfer function. Units are radians.name_stem.admit Admittance spectrum, or real part of the transfer function. Units of (Y / X).name_stem.coh (Squared) coherency spectrum, or linear correlation coefficient as a function of frequency. Dimensionless number in [0, 1]. The Signal-to-Noise-Ratio (SNR) is coh / (1 - coh). SNR = 1 when coh = 0.5.

**REQUIRED** **ARGUMENTS**

x[y]fileASCII (or binary, see-bi) file holding X(t) [Y(t)] samples in the first 1 [or 2] columns. If no file is specified,spectrum1dwill read from standard input.-Ssegment_sizeis a radix-2 number of samples per window for ensemble averaging. The smallest frequency estimated is 1.0/(segment_size*dt), while the largest is 1.0/(2 *dt). One standard error in power spectral density is approximately 1.0 / sqrt(n_data/segment_size), so ifsegment_size= 256, you need 25,600 data to get a one standard error bar of 10%. Cross-spectral error bars are larger and more complicated, being a function also of the coherency.

**OPTIONS**

-CRead the first two columns of input as samples of two timeseries, X(t) and Y(t). Consider Y(t) to be the output and X(t) the input in a linear system with noise. Estimate the optimum frequency response function by least squares, such that the noise output is minimized and the coherent output and the noise output are uncorrelated. Optionally specify up to 8 letters from the set {xycnpago} in any order to create only those output files instead of the default [all].x= xpower,y= ypower,c= cpower,n= npower,p= phase,a= admit,g= gain,o= coh.-DdtSet the spacing between samples in the timeseries [Default = 1].-Nname_stemSupply the name stem to be used for output files [Default = "spectrum"].-VSelects verbose mode, which will send progress reports to stderr [Default runs "silently"].-WWrite Wavelength rather than frequency in column 1 of the output file[s] [Default = frequency, (cycles /dt)].-biSelects binary input. Appendsfor single precision [Default isd(double)]. UppercaseSorDwill force byte-swapping. Optionally, appendncol, the number of columns in your binary input file if it exceeds the columns needed by the program. Or appendcif the input file is netCDF. Optionally, appendvar1/var2/...to specify the variables to be read. [Default is 2 input columns].-boSelects binary output. Appendsfor single precision [Default isd(double)]. UppercaseSorDwill force byte-swapping. Optionally, appendncol, the number of desired columns in your binary output file. [Default is 2 output columns].-fSpecial formatting of input and/or output columns (time or geographical data). Specifyioroto make this apply only to input or output [Default applies to both]. Give one or more columns (or column ranges) separated by commas. AppendT(absolute calendar time),t(relative time in chosenTIME_UNITsinceTIME_EPOCH),x(longitude),y(latitude), orf(floating point) to each column or column range item. Shorthand-f[i|o]gmeans-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 toOUTPUT_DEGREE_FORMAT, whereas other values are formatted according toD_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 (-boif available) or specify more decimals using theD_FORMATsetting.

**EXAMPLES**

Suppose data.g is gravity data in mGal, sampled every 1.5 km. To write its power spectrum, in mGal**2-km, to the file data.xpower, usespectrum1ddata.g-S256-D1.5-Ndata Suppose in addition to data.g you have data.t, which is topography in meters sampled at the same points as data.g. To estimate various features of the transfer function, considering data.t as input and data.g as output, use paste data.t data.g |spectrum1d-S256-D1.5-Ndata-C

**SEE** **ALSO**

GMT(1),grdfft(1)

**REFERENCES**

Bendat, J. S., and A. G. Piersol, 1986, Random Data, 2nd revised ed., John Wiley & Sons. Welch, P. D., 1967, The use of Fast Fourier Transform for the estimation of power spectra: a method based on time averaging over short, modified periodograms, IEEE Transactions on Audio and Electroacoustics, Vol AU-15, No 2.