Description
Supported indexing variables:
itime: sample index within a vector
ix: global processed-column index
jx: column index within the current group
igroup: processed-group index
nx: number of columns in the current group
Supported scalar variables:
field, field.previous
Supported vector values:
data, data[index]
Supported vector coordinates:
data.s0, data.ds, data.time, data.ns
Synopsis
sgfieldmath <stdin >stdout
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
in |
ifile |
stdin
|
input data |
out |
ofile |
stdout
|
output data |
Input and output
Input
input data
Output
output data
Examples
1. Create a scalar offset from source and receiver coordinates
sgfieldmath offset:f='((sx-gx)^2+(sy-gy)^2)^0.5' <input.sg >offset.sgInput must contain scalar sx, gx, sy and gy fields with compatible units.
The new float field offset contains the Euclidean source-receiver distance.
2. Create a vector by adding a constant to each sample
sgfieldmath data2:F='data+0.5' <input.sg >derived.sgInput must contain a data vector; data2 contains data plus 0.5 per sample.
The uppercase type requests a vector rather than a scalar.
3. Update a scalar offset and apply sine to vector samples
sgfieldmath offset='abs(soffset)' data='sin(data)' <input.sg >updated.sgInput must contain soffset and existing offset and data fields.
Sine interprets its argument in radians; verify that this is meaningful for data.
Supported built-in functions are: sin, cos, tan, asin, acos, atan, if,
real, imag, abs, conj, exp, log, log10, sigmoid,ricker, sinc, erf, erfc, erfinv,
randu, randn, randr, randc, randl
4. Replace a vector with a sampled Ricker wavelet
sgfieldmath data='ricker(2*PI*30*(data.time-0.5))' <input.sg >wavelet.sgInput must contain data with correct sampling origin and interval.
For time in seconds, 30 is central frequency of Hz and 0.5 is the centre
time in seconds; verify the resulting spectrum rather than assuming a peak frequency.
Supported built-in phsycial constants are: PI, I
5. Rename two existing fields while retaining their values
sgfieldmath data.rename=vector1 data1.rename=vector2 <input.sg >renamed.sgInput must contain data and data1; choose unused output names.
6. Create a scalar containing the mean of each data vector
sgfieldmath mean:f=data.mean <input.sg >means.sgInput must contain a data vector; mean is a float scalar per input column,
not an aggregate across categorical records.
Supported vector statistics include: data.sum, data.sum2, data.mean, data.rms,
data.min, data.max, data.amin, data.amax, data.imin, data.imax
7. Create a vector with negative samples replaced by zero
sgfieldmath positive:F='if((data>=0),data,0)' <input.sg >positive.sgInput must contain a real data vector; positive retains nonnegative values.
Commands are illustrative and require output checks on the intended datasets.