NAME

     replace  - replace, detect,do math, set a velocity gradient,
     apend  or  insert  a  function, set a max/min value and swap
     values on a range of samples in selected records/traces with
     a  user specified value or from a pair of headerwords. These
     functions may useful for any type of USP formatted dataset.


SYNOPSIS

     replace [ -Nntap ] [ -N2ntap ] [ -Ootap ]  [  -HW1  or  -hw1
     hdrwd1  ]  [ -HW2 or -hw2 hdrwd2 ] [ -HW3 or -hw3 hdrwd3 ] [
     -HW4 or -hw4 hdrwd4 ] [ -HW5 or -hw5 hdrwd4 ] [ -h4scale ] [
     -sist  ]  [  -eiend  ] [ -rsrecordstart ] [ -rerecordend ] [
     -nstracestart ] [ -netraceend ] [ -valueval ] [ -biasvbias ]
     [ -scalevscl ] [ -voinitvel ] [ -vgradvelgrad ] [ -refrefer-
     ence ] [ -swapaval1 ] [ -swapbval2 ] [ -minminval ] [  -max-
     maxval ] [ -top ] [ -bot ] [ -I ] [ -M ] [ -D ] [ -V ] [ -h,
     -? ]


DESCRIPTION

     replace either replaces, detects, does simple math, or  sets
     a  gradient  on  a range of samples defined by start and end
     times (or depths) of selected traces  or  ranges  of  traces
     with a user specified value. The math involves adding a bias
     to the current value and/or scaling the  curent  value.  The
     gradient  option involves the definition of a starting velo-
     city and gradient with a reference point.   The  alteration,
     whatever  it  is,  is  done  either on isolated traces or on
     ranges of traces defined by record-trace  number  pairs,  or
     globally  across  the  entire  data  set.  DATA NOT DIRECTLY
     AFFECTED BY THE REPLACEMENT PROCESS IS PASSED UNAFFECTED.

     Replace has the option of time or depth  range  sample  con-
     straining,  using values located in the user defined header-
     words.  The user can apply USP program recshift  (for  exam-
     ple)  and two separate XSD pick files to define an upper and
     lower limit of contraint and place the time or depth  values
     in  any two headerwords to be flagged in program replace for
     value constraining.  Data not  directly  affecteded  by  the
     contraint option is passed unaffected.

     While performing a replace operation, replace has the option
     to  read  a  user  defined  null value from the user defined
     header word and pass the trace with  no  change.   The  user
     must  be sure to define the null value on command line.  The
     program will look for this null value  in  either  the  user
     defined HW1 or HW2.

     replace gets both its data and its parameters  from  command
     line  arguments.  These arguments specify the input, output,
     the optional file name containing record and trace  numbers,
     the  replacement  window, the replacement value, and verbose
     printout, if desired.

  Command line arguments
     -N ntap
          Enter the input data set name or file immediately after
          typing -N unless the input is from a pipe in which case
          the -N entry must be omitted.  This input  file  should
          include the complete path name if the file resides in a
          different directory.  Example -N/b/vsp/dummy tells  the
          program to look for file 'dummy' in directory '/b/vsp'.

     -N2 ntap
          Enter the secondary input data set name or file immedi-
          ately  after  typing -N2.  This is the dataset the pro-
          gram will use to replace values  from.  This  data  set
          will  be apended to the data set from -N.  If the -I is
          used, this data set will be inserted into the file from
          -N.

     -O otap
          Enter the output data  set  name  or  file  immediately
          after typing -O.  This output file is not required when
          piping the output to another process.  The output  data
          set also requires the full path name (see above).

     -s ist
          Enter the global start time (or depth) of the  replace-
          ment.  Default = trace start.

     -e iend
          Enter the global end time (or depth)  of  the  replace-
          ment.  Default = trace end.

     -rs recordstart
          Enter the start record for record constrained  replace-
          ment.  Default = first record.

     -rs recordend
          Enter the end record for  record  constrained  replace-
          ment.  Default = last record.

     -ns tracestart
          Enter the start trace for  trace  constrained  replace-
          ment.  Default = first trace.

     -ne traceend
          Enter the end trace for trace constrained  replacement.
          Default = last trace.

     -HW1 or -hw1  hdrwd1
          Enter the  first  trace  header  word  menmonic  to  be
          tested.  No default.


     -HW2 or -hw2 hdrwd2
          Enter the second  trace  header  word  menmonic  to  be
          tested.  No default.

     -HW3 or -hw3 hdrwd3
          Enter the  third  trace  header  word  menmonic  to  be
          tested.  This is to be used when storing the reference.
          No default.

     -HW4 or -hw4 hdrwd4
          Enter the fourth  trace  header  word  menmonic  to  be
          tested.   This  is  to  be used to replace trace values
          between times in -HW1 and -HW2 with the value stored at
          -HW4.   Not  required  if you are using -hw1 -hw2 and a
          math option, for instance -scale[] and/or -bias[].   If
          you do input a -hw4[] on the commandline it will result
          in this  option  overriding  all  other  options.   For
          instance  your  math  stuff will not get done, only the
          replacement will be accomplished.

     -HW5 or -hw5 hdrwd5
          Enter the trace header word menmonic to be tested.   If
          used,  the gradient mode will be enabled.  The gradient
          -vgrad[] should be completed on the command line.   The
          v0  for  each trace will come from this header location
          allowing a variable v0 across your dataset.

     -h4scale
          If present on the command line use the value in -hw4 to
          scale  the  data between -hw1 and -hw2.  This option is
          only valid when -hw4 is specified on the  command  line
          as well.

     -value val
          Enter the value to replace.  Default = 0.0.

     -bias vbias
          Enter the bias to add  to  the  current  sample  value.
          Default = 0.0

     -scale vscl
          Enter the factor by which to scale the  current  sample
          value.  Default = 1.0

          -vo initial velocity
          Enter the initial velocity when replacing with  a  gra-
          dient.  Default = 0.0

     -vgrad velocity gradient
          Enter the velocity gradient when replacing with a  gra-
          dient.  Default = 0.0

     -ref referecnce elevation
          Enter the reference elevation  when  replacing  with  a
          gradient.  Default = top of replacement window

     -swapa val_a
          Enter the value which is being replaced by swapb.

     -swapb val_b
          Enter the value which is replaceing swapa.

     -min minval
          Enter the minimum  allowable  value  for  the  dataset.
          Default  is to repalce any values less than minval with
          minval.  If -value is used then values less than minval
          are replaced with val.

     -max maxval
          Enter the maximum  allowable  value  for  the  dataset.
          Default  is  to  repalce any values greater than maxval
          with maxval.  If -value is  used  then  values  greater
          than maxval are replaced with val.

     -top Enter the command line argument '-top' to start the min
          or  max replacement operation from the top of the trace
          and work downward, ceasing replacement after the  first
          violation of the min or max constraint.

     -bot Enter the command line argument '-bot' to start the min
          or  max  replacement  operation  from the bottom of the
          trace and work upward, ceasing  replacement  after  the
          first violation of the min or max constraint.

     -I   Enter the command line argument '-I' to  indicate  that
          the  replacement  operation is file insertion.  If com-
          bined with an entry for -value[] then any sample in the
          -N[]  dataset  will be replaced by the same sample from
          the -N2[] dataset.  Default action is to  replace  -N[]
          with -N2[] inside constraints.

     -D   Enter the command line argument '-D' to  indicate  that
          the  replacement operation is to detect the value given
          in the -value option and replace it with  the  previous
          sample value (a type of extrapolation).

     -M   Enter the command line argument '-M' to create  a  mask
          by forcing all non zero sample values to be 1.0

     -?   Enter the command line  argument  '-?'  to  get  online
          help.   The program terminates after the help screen is
          printed.



DISCUSSION

     This program will not allow for the  editing  of  a  volume.
     The  start  and end time and Index Contraints (trace record)
     are used as constraints on the replacement.  This gives  the
     user  the  ability  to  constrain model replacements with as
     many variables as are available.

     The following examples show how to use the program:

     For a basic gradient function over  all  the  data  starting
     with 1500 and having a gradient of 3.2

      replace -Ninfile -Ooutfile -vo1500 -vgrad3.2

     To to do the same but restrict it within traces 200 and  350
     and  also restrict the gradient to a time of 1000ms and 2000
     ms.

     replace -Ninfile -Ooutfile  -vo1500 -vgrad3.2 -ns200 -ne350

      -s1000 -e2000

     To perform the same gradient restrict it to times written in
     header words TVPT01 and TVPT02.

     replace -Ninfile -Ooutfile  -vo1500 -vgrad3.2 -Hw1TVPT01

      -Hw2TVPT02

     To apend a funciton (either 1 fuction to all the data  or  a
     complete  volume).   This  will  apend  file2  at the end of
     file1.

     replace -Nfile1 -N2file2 -Ooutfile

     To insert any part of file2 into file1  (similar  to  apend-
     ing).

     replace -Nfile1 -N2file2 -Ooutfile -I

     To replace trace values (a velocity function) between  times
     specified  by -HW1 (TVPT01) and -HW2 (TVPT02) with the value
     stored at -HW4 (TVPT20).

     replace -Ninfile -Ooutfile -HW1TVPT01 -HW2TVPT02 -HW4TVPT20

     To scale trace values (a velocity  function)  between  times
     specified  by  -HW1  (TVPT01)  and  -HW2  (TVPT02) by 10 and
     adding 1540 using -scale and -bias.

-bias 1540.0
     replace -Ninfile -Ooutfile -hw1 TVPT01 -hw2  TVPT02  -
          scale  10.0

     To replace all values of 10.3  in dataset -N[]  with  values
     from dataset -N2[].

     replace -N data1 -N2 data2 -value 10.3 -I -O dataout

     All  other  fuctionality  is  similar  to  these   examples.
     Replace   also  have  very  useful min/max options which can
     easily be use  for  QC  of  data  (i.e.  ensuring  reasoable
     values).   The above examples are the basic constraints that
     the user can apply when using replace.


BUGS

     unknown


ALSO SEE

     recshift, scale, vstak, ttothen, vomit, velin,  vi3d,  rest,
     flatten, horvel, horvel3d


AUTHOR

     James M. Gridley































Man(1) output converted with man2html