mbsegypsd(1)

NAME
mbsegypsd - Calculates the power spectral densisty function (PSD) of each trace in a segy file, outputting the PSD estimates as a GMT grid file with trace number along the x axis and frequency along the y axis.

VERSION
Version 5.0

SYNOPSIS
mbsegypsd -Ifile -Oroot [-Ashotscale -Ddecimatex -R -Smode[/start/end[/schan/echan]] -Tsweep[/delay] -Wmode/start/end -H -V]";

DESCRIPTION
mbsegypsd calculates the power spectral densisty function (PSD) of each trace in a segy file, outputting the PSD estimates as a grid with trace number along the x axis and frequency along the y axis. The output files are GMT netCDF format grid files. The x-dimension of the grid is determined by the number of traces specified by the -S option and any decimation specified with option -D. If the -S option is not specified, then all of the traces in the segy file will be processed. If the time sweep and delay (if any) are not specified using the -T option, then the sweep and delay will be set so that all trace samples are incorporated into the grid. The y-dimension of the grid is determined by the sample interval in the time series data. The frequency range runs from zero Hz to a maximum frequency given in Hz by 1/(2*sampleinterval), where the sampleinterval is in seconds. So, for instance, hydrophone data sampled at 26 kHz (26000 samples/second) will have a sample interval of (1/26000 = 0.00003846 seconds). In this case, the PSD will be calculated for frequencies ranging from 0 Hz to 13000 Hz (13 kHz). For each trace, the PSD will be calculated by ensemble averaging, which means that the trace will be broken up into a number of segments of length nfft (specified with the -N option, default = 1024), a fast-Fourier-transform (FFT) will be calculated for each segment, and the PSD estimate will be the average of the FFT magnitudes over all segments. Before the FFT is calculated, each segment is multiplied by a Hanning (cosine) taper; the PSD estimates are normalized to account for the loss of signal due to the taper application. The output grid can be either in linear units (Intensity/Hz) or in log-scaled dB/Hz calculated as 20 * log10 (raw-PSD-value). The default is the former, and the -L option causes output in the dB/Hz form. A shellscript invoking GMT programs to plot the PSD grid is automatically generated.

AUTHORSHIP
David W. Caress (caress@mbari.org)
  Monterey Bay Aquarium Research Institute
Dale N. Chayes (dale@ldeo.columbia.edu)
  Lamont-Doherty Earth Observatory

OPTIONS

-A  shotscale
    This option causes the x-axis to be rescaled from shot number to distance in meters. The shotscale value represents the shot spacing in meters.

-D  decimatex
    Sets the decimation of traces (decimatex) used in generating the output grid.

-H  This "help" flag cause the program to print out a description of its operation and then exit immediately.

-I  segyfile
    Sets the filename of the input segy seismic data file to be gridded.

-L
    Sets the PSD grid output to be in dB/Hz.

-O  root
    Sets the filename root for the output GMT netCDF format grid.

-S  mode[/start/end[/schan/echan]]
    This option sets the range of traces that are gridded, and thus determines the x-dimension of the output grid (also impacted by any decimation specified with -D). If mode = 0, then start and end refer to shot numbers. This typically is useful for subbottom data or seismic data in shot gather form. If mode = 1, then start and end refer to CMP (or RP or CDP) numbers. This typically is useful for seismic reflection data in stacked or CMP gather forms. If the data are multichannel seismic reflection or seismic refraction in either shot or CMP gathers, the start and end of the channels selected for gridding is set using the optional schan and echan, respectively. The x-dimension of the output grid is determined by (end - start + 1) * (echan - schan + 1) / decimatex.

-T  sweep[/delay]
    The sweep value sets the time range of seismic data to be processed in seconds. The optional delay value sets the sweep start time, again in seconds.

-V  Normally, mbsegypsd prints out information regarding its controlling parameters during execution; the -V option causes the program to also print out statements indicating its progress.

-W  mode/start/end
    This option can be used to limit the data being processed to a particular time window in various ways. This option does not impact the definition of the overall grid bounds, but does restrict the data processed to samples within particular times of interest. If mode = 1, then start and end are simply start and end times of good data in seconds. If mode = 2, then start and end are relative to the time of the bottom return. In this case start is often negative so that the grid shows data above the seafloor, and then down into the subsurface. Finally, if mode = 3, then start and end are relative to the time corresponding to the sonar depth.

EXAMPLES
Suppose that one has a segy file of hydrophone data sampled at a 37 microsecond interval, corresponding to a 27027 Hz sampling rate. Each of 1610 traces consists of 64865 samples. In order to create a sonogram displaying the power spectral density as a function of time, execute mbsegypsd as follows:
     mbsegypsd -I 20090922_1833_V3422_S7_CH025ms.segy -N1024 -L -O testpsd -V
Here the -N option sets the FFT dimension used to be 1024 samples, which means that the PSD estimate for each trace is the average of 64865 / 1024 = 63 calculations. The shell output of the program is:
     Program mbsegypsd
     Version $Id: mbsegypsd.c 1770 2009-10-19 17:16:39Z caress $
     MB-system Version 5.1.2beta12

     MBsegypsd Parameters:
     Input segy file: 20090922_1833_V3422_S7_CH025ms.segy
     Output fileroot: testpsd
     Input Parameters:
          trace mode: 0
          trace start: 0
          trace end: 1609
          channel start: 1
          channel end: 1
          trace decimation: 1
          time sweep: 2.399968 seconds
          time delay: 0.000000 seconds
          sample interval: 0.000037 seconds
          window mode: 0
          window start: 0.000000 seconds
          window end: 0.000000 seconds
     Output Parameters:
          grid filename: testpsd.grd
          psd filename: testpsd_psd.txt
          x grid dimension: 1610
          y grid dimension: 513
          grid xmin: -0.500000
          grid xmax: 1609.500000
          grid ymin: -13.171066
          grid ymax: 13500.342448
          NaN values used to flag regions with no data
          shotscale: 1.000000
          frequencyscale: 1.000000

     PROCESS read:0 position:0 shot:0 channel:1 2009/265 18:32:59.000 samples:64864 interval:37 usec minmax: -102498.789062 -187.008667
     PROCESS read:25 position:25 shot:25 channel:1 2009/265 18:34:14.000 samples:64864 interval:37 usec minmax: -201902.890625 9166.462891
     PROCESS read:50 position:50 shot:50 channel:1 2009/265 18:35:29.000 samples:64864 interval:37 usec minmax: -203695.765625 28316.906250
     PROCESS read:75 position:75 shot:75 channel:1 2009/265 18:36:44.000 samples:64864 interval:37 usec minmax: -201434.375000 24819.115234
     PROCESS read:100 position:100 shot:100 channel:1 2009/265 18:37:59.000 samples:64864 interval:37 usec minmax: -16544.123047 37.462040
     ............................
     PROCESS read:1500 position:1500 shot:1500 channel:1 2009/265 19:47:59.000 samples:64864 interval:37 usec minmax: -8367.179688 -876.420044
     PROCESS read:1525 position:1525 shot:1525 channel:1 2009/265 19:49:14.000 samples:64864 interval:37 usec minmax: -9163.580078 201.037201
     PROCESS read:1550 position:1550 shot:1550 channel:1 2009/265 19:50:29.000 samples:64864 interval:37 usec minmax: -12128.291016 -993.766357
     PROCESS read:1575 position:1575 shot:1575 channel:1 2009/265 19:51:44.000 samples:64864 interval:37 usec minmax: -67764.585938 2457.883789
     PROCESS read:1600 position:1600 shot:1600 channel:1 2009/265 19:52:59.000 samples:64864 interval:37 usec minmax: -190216.031250 -14304.720703
 .br
 .br The output PSD grid file is named testpsd.grd. A shellscript named testpsd.grd.cmd is also created that, when executed, will generate a plot of the sonogram. MBsegypsd also outputs an ascii file containing the average PSD for the entire segy file in the form of frequency PSD pairs. In this case, the average PSD file is named testpsd_psd.txt, and has contents like:
     0.000000 193.762464
     26.342132 99.114274
     52.684263 93.781880
     79.026395 86.775795
     105.368526 80.297280
     131.710658 74.908340
     158.052790 71.366137
     184.394921 70.319082
     210.737053 69.840534
     237.079184 70.794517
     263.421316 72.002905
     289.763448 71.979001
     316.105579 70.637717
     342.447711 69.652364
     ..............
     13329.118592 -13.659568
     13355.460724 -13.722928
     13381.802855 -12.981740
     13408.144987 -12.626286
     13434.487119 -12.533222
     13460.829250 -13.659002
     13487.171382 -24.474310
A shellscript named testpsd_psd.txt.cmd is created that will, when executed, generate a plot of the average PSD.

SEE ALSO
mbsystem(l), mbm_grdplot(l), mbmosaic(l), mbm_grid(l)

BUGS
Probably... The plots could be better...