1.5.0
CCC
 
seismic.cpp File Reference
#include "geoslib_old_f.h"
#include "geoslib_enum.h"
#include "Enum/EJustify.hpp"
#include "Basic/Law.hpp"
#include "Db/Db.hpp"
#include "Db/DbGrid.hpp"
#include "Model/Model.hpp"
#include "Basic/Utilities.hpp"
#include "Basic/String.hpp"
#include "Basic/OptDbg.hpp"
#include "Basic/Memory.hpp"
#include "Core/Seismic.hpp"
#include <math.h>

Classes

struct  ST_Seismic_Neigh
 

Functions

static int st_velocity_minmax (int nech, double *vv, double *v0, double *v1, double *vmin, double *vmax)
 
static void st_yxtoxy (int nx, double dx, double x0, const double *y, int ny, double dy, double y0, double xylo, double xyhi, double *x)
 
static double dsinc (double x)
 
static void stoepd (int n, const double *r, const double *g, double *f, double *a)
 
static void st_mksinc (double d, int lsinc, double *sinc)
 
static void st_intt8r (int ntable, double table[][LTABLE], int nxin, double dxin, double fxin, const double *yin, double yinl, double yinr, int nxout, const double *xout, double *yout)
 
static void st_weights (double table[][LTABLE])
 
static void st_seismic_debug (int rankz, int nz, double z0, double dz, int rankt, int nt, double t0, double dt, double vmin, double vmax)
 
int seismic_z2t_grid (int verbose, DbGrid *db_z, int iatt_v, int *nx, double *x0, double *dx)
 
int seismic_t2z_grid (int verbose, DbGrid *db_t, int iatt_v, int *nx, double *x0, double *dx)
 
static void st_copy (int mode, DbGrid *db, int iatt, int ival, double *tab)
 
static int st_match (DbGrid *db_z, DbGrid *db_t)
 
static void st_seismic_z2t_convert (DbGrid *db_z, int iatt_z, int nz, double z0, double, double dz, DbGrid *db_t, int iatt_t, int nt, double t0, double t1, double dt, DbGrid *db_v, int iatt_v, int natt, double *tz, double *zt, double *at, double *az)
 
static void st_seismic_t2z_convert (DbGrid *db_t, int iatt_t, int nt, double t0, double t1, double dt, DbGrid *db_z, int iatt_z, int nz, double z0, double z1, double dz, DbGrid *db_v, int iatt_v, int natt, double *tz, double *zt, double *at, double *az)
 
static double TR_IN (Db *db, int iatt_in, int iatt, int itrace, int it)
 
static void TR_OUT (Db *db, int iatt_out, int iatt, int itr, int it, double value)
 
static int st_seismic_operate (Db *db, int oper, int natt, int nt, int iatt_in, int iatt_out, double dt)
 
static double * st_seismic_wavelet (int verbose, int type, int ntw, int tindex, double dt, double fpeak, double period, double amplitude, double distort)
 
static void st_seismic_convolve (int nx, int ix0, const double *x, int ny, int iy0, const double *y, int nz, int iz0, double *z)
 
int seismic_z2t_convert (DbGrid *db_z, int iatt_v, DbGrid *db_t)
 
int seismic_t2z_convert (DbGrid *db_t, int iatt_v, DbGrid *db_z)
 
int seismic_operate (DbGrid *db, int oper)
 
static void st_seismic_affect (Db *, int nz, int shift, double val_before, double val_middle, double val_after, const double *tab0, double *tab1)
 
static void st_seismic_contrast (int nz, double *tab)
 
int seismic_convolve (DbGrid *db, int flag_operate, int flag_contrast, int type, int ntw, int option, int tindex, double fpeak, double period, double amplitude, double distort, double val_before, double val_middle, double val_after, double *wavelet)
 
static int st_absolute_index (DbGrid *db, int ix, int iz)
 
static void st_sample_remove_central (ST_Seismic_Neigh *ngh)
 
static void st_sample_add (DbGrid *db, int iatt_z1, int iatt_z2, int flag_test, int ix, int iz, ST_Seismic_Neigh *ngh)
 
static void st_estimate_check_presence (DbGrid *db, int ivar, int *npres, int *presence)
 
static void st_estimate_neigh_init (ST_Seismic_Neigh *ngh)
 
static ST_Seismic_Neighst_estimate_neigh_management (int mode, int nvois, ST_Seismic_Neigh *ngh)
 
static int st_estimate_neigh_unchanged (ST_Seismic_Neigh *ngh_old, ST_Seismic_Neigh *ngh_cur)
 
static void st_estimate_neigh_copy (ST_Seismic_Neigh *ngh_cur, ST_Seismic_Neigh *ngh_old)
 
static void st_estimate_neigh_print (ST_Seismic_Neigh *ngh, int ix0, int iz0)
 
static int st_estimate_neigh_create (DbGrid *db, int flag_exc, int iatt_z1, int iatt_z2, int ix0, int iz0, int nbench, int nv2max, int[2], int *presence[2], ST_Seismic_Neigh *ngh)
 
static void st_estimate_flag (ST_Seismic_Neigh *ngh, int nfeq, int *flag, int *nred)
 
static void st_estimate_var0 (Model *model, double *var0)
 
static void st_estimate_c00 (Model *model, double *c00)
 
static void st_estimate_lhs (ST_Seismic_Neigh *ngh, Model *model, int nfeq, int nred, int *flag, double *lhs)
 
static void st_estimate_rhs (ST_Seismic_Neigh *ngh, Model *model, int nfeq, int nred, int *flag, double *rhs)
 
static void st_wgt_print (ST_Seismic_Neigh *ngh, int nvar, int nech, int nred, const int *flag, const double *wgt)
 
static int st_estimate_wgt (ST_Seismic_Neigh *ngh, Model *, int nred, int *flag, double *lhs, double *rhs, double *wgt)
 
static void st_estimate_result (Db *db, ST_Seismic_Neigh *ngh, int flag_std, int, int nred, const int *flag, const double *wgt, const double *rhs, const double *var0, int *iatt_est, int *iatt_std)
 
static void st_simulate_result (DbGrid *db, int ix0, int iz0, ST_Seismic_Neigh *ngh, int nbsimu, int, int nred, const int *flag, const double *wgt, const double *rhs, const double *c00, int *iatt_sim)
 
static int st_estimate_sort (const int *presence, int *rank)
 
int seismic_estimate_XZ (DbGrid *db, Model *model, int nbench, int nv2max, int flag_ks, int flag_std, int flag_sort, int flag_stat)
 
static void st_copy_attribute (Db *db, int nbsimu, int *iatt)
 
int seismic_simulate_XZ (DbGrid *db, Model *model, int nbench, int nv2max, int nbsimu, int seed, int flag_ks, int flag_sort, int flag_stat)
 

Variables

static MatrixSquareGeneral covtab
 
static double DX
 
static double DZ
 
static int NX
 
static int NY
 
static int NZ
 
static int NVAR
 
static int NTRACE
 
static double VFACT = 1000.
 
static int IECH_OUT = -1
 

Function Documentation

◆ dsinc()

static double dsinc ( double  x)
static

Function for tabulating dsinc()

Returns
Value of the dsinc() function
Parameters
[in]xArgument of the function

◆ seismic_convolve()

int seismic_convolve ( DbGrid db,
int  flag_operate,
int  flag_contrast,
int  type,
int  ntw,
int  option,
int  tindex,
double  fpeak,
double  period,
double  amplitude,
double  distort,
double  val_before,
double  val_middle,
double  val_after,
double *  wavelet 
)

Convolve with a given wavelet

Returns
Array containing the discretized wavelet, allocated here
Parameters
[in]dbDb structure
[in]flag_operate1 to perform the convolution; 0 otherwise
[in]flag_contrast1 to perform contrast; 0 otherwise
[in]typeType of the wavelet (ENUM_WAVELETS)
[in]ntwhalf-length of the wavelet excluding center (samples)
[in]optionoption used to perform the convolution
  • -1 : erode the edge (on ntw pixels)
  • 0 : truncate the wavelet on the edge
  • +1 : extend the trace with padding before convolution
  • +2 : extend the trace with the last informed values
[in]tindextime index to locate the spike (Spike)
[in]fpeakpeak frequency of the Ricker wavelet
[in]periodwavelet period (s) (Ricker)
[in]amplitudewavelet amplitude (Ricker)
[in]distortwavelet distortion factor (Ricker)
[in]val_beforeReplacement value for undefined element before first defined sample
[in]val_middleReplacement value for undefined element between defined samples
[in]val_afterReplacement value for undefined element after last defined sample
[in]waveletWavelet defined as input (Dimension: 2*ntw+1)

◆ seismic_estimate_XZ()

int seismic_estimate_XZ ( DbGrid db,
Model model,
int  nbench,
int  nv2max,
int  flag_ks,
int  flag_std,
int  flag_sort,
int  flag_stat 
)

Perform a bivariate estimation on a grid

Returns
Error return code
Parameters
[in,out]dbGrid Db structure
[in]modelModel structure
[in]nbenchVertical Radius of the neighborhood (center excluded)
[in]nv2maxMaximum number of traces of second variable on each side of the target trace
[in]flag_ks1 for a Simple Kriging; otherwise Ordinary Kriging
[in]flag_std1 for the calculation of the St. Dev.
[in]flag_sort1 if the traces to be treated are sorted by increasing distance to trace where first variable is defined
[in]flag_stat1 for producing final statistics

◆ seismic_operate()

int seismic_operate ( DbGrid db,
int  oper 
)

Do unary arithmetic operation on traces

Returns
Error return code
Parameters
[in]dbDb structure
[in]operOperator flag (ENUM_SEISMICS)
Remarks
Operations inv, slog and slog10 are "punctuated", meaning that if,
the input contains 0 values, 0 values are returned.

◆ seismic_simulate_XZ()

int seismic_simulate_XZ ( DbGrid db,
Model model,
int  nbench,
int  nv2max,
int  nbsimu,
int  seed,
int  flag_ks,
int  flag_sort,
int  flag_stat 
)

Perform a bivariate cosimulation on a grid

Returns
Error return code
Parameters
[in,out]dbGrid Db structure
[in]modelModel structure
[in]nbenchVertical Radius of the neighborhood (center excluded)
[in]nv2maxMaximum number of traces of second variable on each side of the target trace
[in]nbsimuNumber of simulations
[in]seedSeed for the random number generator
[in]flag_ks1 for a Simple Kriging; otherwise Ordinary Kriging
[in]flag_sort1 if the traces to be treated are sorted by increasing distance to trace where first variable is defined
[in]flag_stat1 for producing final statistics

◆ seismic_t2z_convert()

int seismic_t2z_convert ( DbGrid db_t,
int  iatt_v,
DbGrid db_z 
)

Resample from time to depth

Returns
Error return code
Parameters
[in]db_tTime Grid structure
[in]iatt_vAddress of the Velocity variable (in Time grid)
[out]db_zDepth Grid structure
Remarks
Linear interpolation and constant extrapolation is used to
determine interval velocities at times not specified.

◆ seismic_t2z_grid()

int seismic_t2z_grid ( int  verbose,
DbGrid db_t,
int  iatt_v,
int *  nx,
double *  x0,
double *  dx 
)

Define the Depth Grid characteristics from the Time Grid

Returns
Error return code
Parameters
[in]verboseVerbose flag
[in]db_tTime Grid structure
[in]iatt_vAttribute address of the Velocity (in Time grid)
[out]nxNumber of grid nodes along each direction
[out]x0Origin of the grid along each direction
[out]dxMesh of the grid along each direction

◆ seismic_z2t_convert()

int seismic_z2t_convert ( DbGrid db_z,
int  iatt_v,
DbGrid db_t 
)

Resample from depth to time

Returns
Error return code
Parameters
[in]db_zDepth Grid structure
[in]iatt_vAddress of the Velocity variable (in Depth grid)
[out]db_tTime Grid structure
Remarks
Linear interpolation and constant extrapolation is used to
determine interval velocities at times not specified.

◆ seismic_z2t_grid()

int seismic_z2t_grid ( int  verbose,
DbGrid db_z,
int  iatt_v,
int *  nx,
double *  x0,
double *  dx 
)

Define the Time Grid characteristics from the Depth Grid

Returns
Error return code
Parameters
[in]verboseVerbose flag
[in]db_zDepth Grid structure
[in]iatt_vAttribute address of the Velocity (int Depth Grid)
[out]nxNumber of grid nodes along each direction
[out]x0Origin of the grid along each direction
[out]dxMesh of the grid along each direction

◆ st_absolute_index()

static int st_absolute_index ( DbGrid db,
int  ix,
int  iz 
)
static

Returns the absolute index of the sample in the grid

Returns
Returned absolute address
Parameters
[in]dbGrid Db structure
[in]ixRank of the target trace
[in]izRank of the target sample within the target trace

◆ st_copy()

static void st_copy ( int  mode,
DbGrid db,
int  iatt,
int  ival,
double *  tab 
)
static

Copy a trace between the Db and a given array

Parameters
[in]modeType of operation
  • 0 : Copy from Db into array
  • 1 : Copy from array into Db
[in]dbDb structure
[in]iattRank of the variable
[in]ivalRank of the column
[in]tabArray containing the column of values

◆ st_copy_attribute()

static void st_copy_attribute ( Db db,
int  nbsimu,
int *  iatt 
)
static

Copy the main attributes in the simulations

Parameters
[in]dbGrid Db structure
[in]nbsimuNumber of simulations
[in]iattAddress of the first item for each variable

◆ st_estimate_c00()

static void st_estimate_c00 ( Model model,
double *  c00 
)
static

Establish the constant terms for the variance calculations

Parameters
[in]modelModel structure
[out]c00Array containing the C00 terms (Dimension: NVAR * NVAR)

◆ st_estimate_check_presence()

static void st_estimate_check_presence ( DbGrid db,
int  ivar,
int *  npres,
int *  presence 
)
static

Check the presence of neighboring traces

Parameters
[in]dbGrid Db structure
[in]ivarRank of the variable of interest
[out]npresNumber of informed traces
[out]presenceArray giving the number of valid samples per trace

◆ st_estimate_flag()

static void st_estimate_flag ( ST_Seismic_Neigh ngh,
int  nfeq,
int *  flag,
int *  nred 
)
static

Establish the Kriging flag

Parameters
[in]nghCurrent ST_Seismic_Neigh structure
[in]nfeqNumber of drift condition per variable
[out]flagArray containing the Kriging flag
[out]nredReduced number of equations

◆ st_estimate_lhs()

static void st_estimate_lhs ( ST_Seismic_Neigh ngh,
Model model,
int  nfeq,
int  nred,
int *  flag,
double *  lhs 
)
static

Establish the Kriging L.H.S.

Parameters
[in]nghCurrent ST_Seismic_Neigh structure
[in]modelModel structure
[in]nfeqNumber of drift condition per variable
[in]nredReduced number of equations
[in]flagArray giving the flag
[out]lhsArray containing the Kriging L.H.S.

◆ st_estimate_neigh_copy()

static void st_estimate_neigh_copy ( ST_Seismic_Neigh ngh_cur,
ST_Seismic_Neigh ngh_old 
)
static

Copy the current neighborhood into the old one

Parameters
[in]ngh_curCurrent ST_Seismic_Neigh structure
[out]ngh_oldOld ST_Seismic_Neigh structure

◆ st_estimate_neigh_create()

static int st_estimate_neigh_create ( DbGrid db,
int  flag_exc,
int  iatt_z1,
int  iatt_z2,
int  ix0,
int  iz0,
int  nbench,
int  nv2max,
int  [2],
int *  presence[2],
ST_Seismic_Neigh ngh 
)
static

Establish the neighborhood

Returns
Error return code
Parameters
[in]dbGrid Db structure
[in]flag_exc1 if the target sample must be excluded
[in]iatt_z1Address of the first data attribute
[in]iatt_z2Address of the second data attribute
[in]ix0Rank of the target trace
[in]iz0Rank of the target sample within the target trace
[in]nbenchVertical Radius of the neighborhood (center excluded)
[in]nv2maxMaximum number of traces of second variable on each side of the target trace
[in]presenceArray giving the number of valid samples per trace
[out]nghCurrent ST_Seismic_Neigh structure

◆ st_estimate_neigh_init()

static void st_estimate_neigh_init ( ST_Seismic_Neigh ngh)
static

Initialize the ST_Seismic_Neigh structure

Parameters
[in]nghST_Seismic_Neigh structure to be freed (if mode<0)

◆ st_estimate_neigh_management()

static ST_Seismic_Neigh* st_estimate_neigh_management ( int  mode,
int  nvois,
ST_Seismic_Neigh ngh 
)
static

Manage the ST_Seismic_Neigh structure

Returns
Address of the newly managed ST_Seismic_Neigh structure
Parameters
[in]modeType of management
  • 1 for allocation
  • -1 for deallocation
[in]nvoisMaximum number of samples in the neighborhood
[in]nghST_Seismic_Neigh structure to be freed (if mode<0)

◆ st_estimate_neigh_print()

static void st_estimate_neigh_print ( ST_Seismic_Neigh ngh,
int  ix0,
int  iz0 
)
static

Print the Kriging Information

Parameters
[in]nghCurrent ST_Seismic_Neigh structure
[in]ix0Rank of the target trace
[in]iz0Rank of the target sample within the target trace

◆ st_estimate_neigh_unchanged()

static int st_estimate_neigh_unchanged ( ST_Seismic_Neigh ngh_old,
ST_Seismic_Neigh ngh_cur 
)
static

Check if the neighborhood has changed

Returns
1 if the Neighborhood is unchanged
Parameters
[in]ngh_oldPrevious ST_Seismic_Neigh structure
[in]ngh_curCurrent ST_Seismic_Neigh structure

◆ st_estimate_result()

static void st_estimate_result ( Db db,
ST_Seismic_Neigh ngh,
int  flag_std,
int  ,
int  nred,
const int *  flag,
const double *  wgt,
const double *  rhs,
const double *  var0,
int *  iatt_est,
int *  iatt_std 
)
static

Perform the Kriging

Parameters
[in]dbGrid Db structure
[in]nghCurrent ST_Seismic_Neigh structure
[in]flag_std1 for the calculation of the St. Dev.
[in]nredReduced number of equations
[in]flagArray giving the flag
[in]wgtArray containing the Kriging weights
[in]rhsArray containing the R.H.S. member
[in]var0Array containing the C00 terms
[in]iatt_estArray of pointers to the kriged result
[in]iatt_stdArray of pointers to the variance of estimation

◆ st_estimate_rhs()

static void st_estimate_rhs ( ST_Seismic_Neigh ngh,
Model model,
int  nfeq,
int  nred,
int *  flag,
double *  rhs 
)
static

Establish the Kriging R.H.S.

Parameters
[in]nghCurrent ST_Seismic_Neigh structure
[in]modelModel structure
[in]nfeqNumber of drift condition per variable
[in]nredReduced number of equations
[in]flagArray giving the flag
[out]rhsArray containing the Kriging R.H.S.

◆ st_estimate_sort()

static int st_estimate_sort ( const int *  presence,
int *  rank 
)
static

Order the traces to be processed

Returns
Error return code
Parameters
[in]presenceArray giving the number of valid samples per trace
[out]rankArray giving the order of the traces

◆ st_estimate_var0()

static void st_estimate_var0 ( Model model,
double *  var0 
)
static

Establish the constant terms for the variance calculations

Parameters
[in]modelModel structure
[out]var0Array containing the C00 terms (Dimension: NVAR)

◆ st_estimate_wgt()

static int st_estimate_wgt ( ST_Seismic_Neigh ngh,
Model ,
int  nred,
int *  flag,
double *  lhs,
double *  rhs,
double *  wgt 
)
static

Establish the Kriging Weights

Returns
Error return code
Parameters
[in]nghCurrent ST_Seismic_Neigh structure
[in]nredReduced number of Kriging equations
[in]flagArray giving the flag
[in]lhsArray of Kriging L.H.S.
[in]rhsArray of Kriging R.H.S.
[out]wgtArray containing the Kriging Weights

◆ st_intt8r()

static void st_intt8r ( int  ntable,
double  table[][LTABLE],
int  nxin,
double  dxin,
double  fxin,
const double *  yin,
double  yinl,
double  yinr,
int  nxout,
const double *  xout,
double *  yout 
)
static

Interpolation of a uniformly-sampled complex function y(x) via a table of 8-coefficient interpolators

Parameters
[in]ntablenumber of tabulated interpolation operators; ntable>=2
[in]tablearray of tabulated 8-point interpolation operators
[in]nxinnumber of x values at which y(x) is input
[in]dxinx sampling interval for input y(x)
[in]fxinx value of first sample input
[in]yinarray of input y(x) values: yin[0] = y(fxin), etc.
[in]yinlvalue used to extrapolate yin values to left of yin[0]
[in]yinrvalue used to extrapolate yin values to right of yin[nxin-1]
[in]nxoutnumber of x values a which y(x) is output
[in]xoutarray of x values at which y(x) is output
[out]youtarray of output y(x) values: yout[0] = y(xout[0]), etc.
Remarks
ntable must not be less than 2.
The table of interpolation operators must be as follows:
Let d be the distance, expressed as a fraction of dxin, from a
particular xout value to the sampled location xin just to the left
of xout. Then:
for d = 0., table[0][0:7] = 0., 0., 0., 1., 0., 0., 0., 0.
are the weights applied to the 8 input samples nearest xout.
for d = 1., table[ntable-1][0:7] = 0., 0., 0., 0., 1., 0., 0., 0.
are the weights applied to the 8 input samples nearest xout.
for d = (float)itable/(float)(ntable-1), table[itable][0:7] are the
weights applied to the 8 input samples nearest xout.
If the actual sample distance d does not exactly equal one of the
values for which interpolators are tabulated, then the interpolator
corresponding to the nearest value of d is used.
Because extrapolation of the input function y(x) is defined by the
left and right values yinl and yinr, the xout values are not
restricted to lie within the range of sample locations defined by
nxin, dxin, and fxin.

◆ st_match()

static int st_match ( DbGrid db_z,
DbGrid db_t 
)
static

Check that the Depth and Time grid coincide

Returns
1 if the two files coincide; 0 otherwise
Parameters
[in]db_zDepth Grid structure
[in]db_tTime Grid structure (optional)
Remarks
In case of error, a message is displayed

◆ st_mksinc()

static void st_mksinc ( double  d,
int  lsinc,
double *  sinc 
)
static

Compute least-squares optimal sinc interpolation coefficients.

Parameters
[in]dfractional distance to interpolation point; 0.0<=d<=1.0
[in]lsinclength of sinc approximation; lsinc%2==0 and lsinc<=20
[out]sincarray[lsinc] containing interpolation coefficients
Remarks
The coefficients are a least-squares-best approximation to the
ideal sinc function for frequencies from zero up to a computed
maximum frequency.
For a given interpolator length, lsinc, mksinc computes the
maximum frequency, fmax (expressed as a fraction of the Nyquist
frequency), using the following empirically derived relation (from
a Western Geophysical Technical Memorandum by Ken Larner):
fmax = min(0.066+0.265*log(lsinc),1.0)
Note that fmax increases as lsinc increases, up to a maximum of 1.
Use the coefficients to interpolate a uniformly-sampled function
y(i) as follows:
lsinc-1
y(i+d) = sum sinc[j]*y(i+j+1-lsinc/2)
j=0
Interpolation error is greatest for d=0.5, but for frequencies less
than fmax, the error should be less than 1.0 percent.

◆ st_sample_add()

static void st_sample_add ( DbGrid db,
int  iatt_z1,
int  iatt_z2,
int  flag_test,
int  ix,
int  iz,
ST_Seismic_Neigh ngh 
)
static

Add the sample to the neighborhood

Parameters
[in]dbGrid Db structure
[in]iatt_z1Address of the first data attribute
[in]iatt_z2Address of the second data attribute
[in]flag_testFlag to check if the sample must be added
  • 0 : only if at least one variable is defined
  • 1 : only if the first variable is defined
  • 2 : only if the second variable is defined
[in]ixRank of the trace
[in]izRank of the target sample within the target trace
[in,out]nghST_Seismic_Neigh structure

◆ st_sample_remove_central()

static void st_sample_remove_central ( ST_Seismic_Neigh ngh)
static

Remove the sample which coincides with the target site from the neighborhood

Parameters
[in,out]nghST_Seismic_Neigh structure

◆ st_seismic_affect()

static void st_seismic_affect ( Db ,
int  nz,
int  shift,
double  val_before,
double  val_middle,
double  val_after,
const double *  tab0,
double *  tab1 
)
static

Loads the values of a Db column in the output array Completes undefined values

Parameters
[in]nzNumber of elements in the column
[in]shiftThe shift of the trace before convolution
[in]val_beforeReplacement value for undefined element before first defined sample
[in]val_middleReplacement value for undefined element between defined samples
[in]val_afterReplacement value for undefined element after last defined sample
[in]tab0Input array (Dimension: nz)
[out]tab1Output array (Dimension: nz)

◆ st_seismic_contrast()

static void st_seismic_contrast ( int  nz,
double *  tab 
)
static

Converts an impedance into a contrast

Parameters
[in]nzNumber of elements in the column
[out]tabOutput array (Dimension: nz)

◆ st_seismic_convolve()

static void st_seismic_convolve ( int  nx,
int  ix0,
const double *  x,
int  ny,
int  iy0,
const double *  y,
int  nz,
int  iz0,
double *  z 
)
static

Compute the convolution of two input vector arrays

Parameters
[in]nxlength of x array
[in]ix0sample index of first x
[in]xarray[nx] to be convolved with y
[in]nylength of y array
[in]iy0sample index of first y
[in]yarray[ny] with which x is to be convolved
[in]nzlength of z array
[in]iz0sample index of first z
[out]zarray[nz] containing x convolved with y
Remarks
The operation z = x convolved with y is defined to be
ix0+nx-1
z[i] = sum x[j]*y[i-j] ; i = iz0,...,iz0+nz-1
j=ix0
The x samples are contained in x[0], x[1], ..., x[nx-1];
likewise for the y and z samples. The sample indices of the
first x, y, and z values determine the location of the origin
for each array. For example, if z is to be a weighted average
of the nearest 5 samples of y, one might use
x[0] = x[1] = x[2] = x[3] = x[4] = 1/5
conv(5,-2,x,ny,0,y,nz,0,z)
In this example, the filter x is symmetric, with index of first
sample = -2.

◆ st_seismic_debug()

static void st_seismic_debug ( int  rankz,
int  nz,
double  z0,
double  dz,
int  rankt,
int  nt,
double  t0,
double  dt,
double  vmin,
double  vmax 
)
static

Debugging printout for the seismic time-to-depth conversion

Parameters
[in]rankzRank for Depth (0 for Input; 1 for Output)
[in]nznumber of depth samples
[in]z0first depth value
[in]dzdepth sampling interval
[in]ranktRank for Time (0 for Input; 1 for Output)
[in]ntnumber of time samples
[in]t0first time value
[in]dttime sampling interval
[in]vminMinimum velocity value
[in]vmaxMaximum velocity value

◆ st_seismic_operate()

static int st_seismic_operate ( Db db,
int  oper,
int  natt,
int  nt,
int  iatt_in,
int  iatt_out,
double  dt 
)
static

Do unary arithmetic operation on traces

Returns
Error return code
Parameters
[in]dbDb structure
[in]operOperator flag (ENUM_SEISMICS)
[in]nattNumber of seismic attributes
[in]ntNumber of samples on input trace
[in]iatt_inAddress of the first input attribute
[in]iatt_outAddress of the first output attribute
[in]dttime sampling interval
Remarks
Operations inv, slog and slog10 are "punctuated", meaning that if,
the input contains 0 values, 0 values are returned.

◆ st_seismic_t2z_convert()

static void st_seismic_t2z_convert ( DbGrid db_t,
int  iatt_t,
int  nt,
double  t0,
double  t1,
double  dt,
DbGrid db_z,
int  iatt_z,
int  nz,
double  z0,
double  z1,
double  dz,
DbGrid db_v,
int  iatt_v,
int  natt,
double *  tz,
double *  zt,
double *  at,
double *  az 
)
static

Resample from time to depth

Parameters
[in]db_tTime Db
[in]iatt_tAddress of the first variable of the Time Db
[in]ntNumber of meshes of the Time Db
[in]t0First Time
[in]t1Last Time
[in]dtMesh of the Time Db
[in]db_zDepth Db
[in]iatt_zAddress of the first variable of the Depth Db
[in]nzNumber of meshes of the Depth Db
[in]z0First Depth
[in]z1Last Depth
[in]dzMesh of the Depth Db
[in]db_vVelocity Db
[in]iatt_vAddress of the velocity variable in Depth Db
[in]nattNumber of seismic attributes
[out]tzWorking array (dimension: nt)
[out]ztWorking array (dimension: nz)
[out]atWorking array (dimension: nt)
[out]azWorking array (dimension: nz)
Remarks
Linear interpolation and constant extrapolation is used to
determine interval velocities at times not specified.

◆ st_seismic_wavelet()

static double* st_seismic_wavelet ( int  verbose,
int  type,
int  ntw,
int  tindex,
double  dt,
double  fpeak,
double  period,
double  amplitude,
double  distort 
)
static

Defining some wavelets for modeling of seimic data

Returns
Array containing the discretized wavelet, allocated here
Dimension = 2 * ntw + 1
Parameters
[in]verbose1 for a verbose output; 0 otherwise
[in]typeType of the wavelet (ENUM_WAVELETS)
[in]ntwhalf-length of the wavelet excluding center (samples)
[in]tindextime index to locate the spike (Spike)
[in]dttime step
[in]fpeakpeak frequency of the Ricker wavelet
[in]periodwavelet period (s) (Ricker)
[in]amplitudewavelet amplitude (Ricker)
[in]distortwavelet distortion factor (Ricker)

◆ st_seismic_z2t_convert()

static void st_seismic_z2t_convert ( DbGrid db_z,
int  iatt_z,
int  nz,
double  z0,
double  ,
double  dz,
DbGrid db_t,
int  iatt_t,
int  nt,
double  t0,
double  t1,
double  dt,
DbGrid db_v,
int  iatt_v,
int  natt,
double *  tz,
double *  zt,
double *  at,
double *  az 
)
static

Resample from depth to time

Parameters
[in]db_zDepth Db
[in]iatt_zAddress of the first variable of the Depth Db
[in]nzNumber of meshes of the Depth Db
[in]z0First Depth
[in]dzMesh of the Depth Db
[in]db_tTime Db
[in]iatt_tAddress of the first variable of the Time Db
[in]ntNumber of meshes of the Time Db
[in]t0First Time
[in]t1Last Time
[in]dtMesh of the Time Db
[in]db_vVelocity Db
[in]iatt_vAddress of the velocity variable in Depth Db
[in]nattNumber of seismic attributes
[out]tzWorking array (dimension: nt)
[out]ztWorking array (dimension: nz)
[out]atWorking array (dimension: nt)
[out]azWorking array (dimension: nz)
Remarks
Linear interpolation and constant extrapolation is used to
determine interval velocities at times not specified.

◆ st_simulate_result()

static void st_simulate_result ( DbGrid db,
int  ix0,
int  iz0,
ST_Seismic_Neigh ngh,
int  nbsimu,
int  ,
int  nred,
const int *  flag,
const double *  wgt,
const double *  rhs,
const double *  c00,
int *  iatt_sim 
)
static

Perform the Simulation

Parameters
[in]dbGrid Db structure
[in]ix0Rank of the target trace
[in]iz0Rank of the target sample within the target trace
[in]nghCurrent ST_Seismic_Neigh structure
[in]nbsimuNumber of simulations
[in]nredReduced number of equations
[in]flagArray giving the flag
[in]wgtArray containing the Kriging weights
[in]rhsArray containing the R.H.S. member
[in]c00Array containing the C00 terms
[in]iatt_simArray of pointers to the simulated results

◆ st_velocity_minmax()

static int st_velocity_minmax ( int  nech,
double *  vv,
double *  v0,
double *  v1,
double *  vmin,
double *  vmax 
)
static

Calculate the extrema of the velocity array vv[]

Returns
Error return code
Parameters
[in]nechNumber of samples in the array vv[]
[in]vvArray of interest
[out]v0Initial velocity value
[out]v1Last velocity value
[out]vminMinimum value
[out]vmaxMaximum value

◆ st_weights()

static void st_weights ( double  table[][LTABLE])
static

Interpolation of a uniformly-sampled real function y(x) via a table of 8-coefficient sinc approximations

Parameters
[out]tablearray of weights

◆ st_wgt_print()

static void st_wgt_print ( ST_Seismic_Neigh ngh,
int  nvar,
int  nech,
int  nred,
const int *  flag,
const double *  wgt 
)
static

Print the kriging weights

Parameters
[in]nghST_Seismic_Neigh structure
[in]nvarNumber of variables
[in]nechNumber of active points
[in]nredReduced number of equations
[in]flagFlag array
[in]wgtArray of Kriging weights

◆ st_yxtoxy()

static void st_yxtoxy ( int  nx,
double  dx,
double  x0,
const double *  y,
int  ny,
double  dy,
double  y0,
double  xylo,
double  xyhi,
double *  x 
)
static

Compute regularly-sampled monotonically increasing function x(y) from regularly-sampled monotonically increasing function y(x) by inverse linear interpolation

Parameters
[in]nxnumber of samples of y(x)
[in]dxx sampling interval; dx>0.0 is required
[in]x0first x
[in]yarray[nx] of y(x) values; y[0] < ... < y[nx-1] required
[in]nynumber of samples of x(y)
[in]dyy sampling interval; dy>0.0 is required
[in]y0first y
[in]xylox value assigned to x(y) when y is less than smallest y(x)
[in]xyhix value assigned to x(y) when y is greater than largest y(x)
[out]xarray[ny] of x(y) values

◆ stoepd()

static void stoepd ( int  n,
const double *  r,
const double *  g,
double *  f,
double *  a 
)
static

Solve a symmetric Toeplitz linear system of equations Rf=g for f

Parameters
[in]ndimension of system
[in]rarray[n] of top row of Toeplitz matrix
[in]garray[n] of right-hand-side column vector
[out]farray[n] of solution (left-hand-side) column vector
[out]aarray[n] of solution to Ra=v (Claerbout, FGDP, p. 57)
Remarks
This routine does NOT solve the case when the main diagonal is
zero, it just silently returns.
The left column of the Toeplitz matrix is assumed to be equal to
the top row (as specified in r); i.e., the Toeplitz matrix is
assumed symmetric.

◆ TR_IN()

static double TR_IN ( Db db,
int  iatt_in,
int  iatt,
int  itrace,
int  it 
)
static

Local function to read the Data Base

Returns
Returned value
Parameters
[in]dbDb structure
[in]iatt_inAddress of the first input attribute
[in]iattRank of the internal attribute
[in]itraceRank of the trace
[in]itRank of the sample on the trace

◆ TR_OUT()

static void TR_OUT ( Db db,
int  iatt_out,
int  iatt,
int  itr,
int  it,
double  value 
)
static

Local function to write into the Data Base

Parameters
[in]dbDb structure
[in]iatt_outAddress of the first input attribute
[in]iattRank of the internal attribute
[in]itrRank of the trace
[in]itRank of the sample on the trace
[in]valueValue to be stored

Variable Documentation

◆ covtab

MatrixSquareGeneral covtab
static

◆ DX

double DX
static

◆ DZ

double DZ
static

◆ IECH_OUT

int IECH_OUT = -1
static

◆ NTRACE

int NTRACE
static

◆ NVAR

int NVAR
static

◆ NX

int NX
static

◆ NY

int NY
static

◆ NZ

int NZ
static

◆ VFACT

double VFACT = 1000.
static