NAME

add, subtract, multiply, divide, etc.
     uspmath - Perform unary math operations  on  many  USP  inputs...


SYNOPSIS

     uspmath -N ntap -N ntap -N ntap -F ftap -O otap -mode mode
             -S scalar -S scalar -S scalar
             -B bias -B bias -B bias
             -eps eps -min min -max max -old old -new new
             -emask emask -nomask -V


DESCRIPTION

     uspmath performs unary math  operations  on  multiple  input
     datasets, creating a single output. Input files must be con-
     formable. uspmath is aware of an embedded mask  (-emask)  in
     the data and only performs operations on live samples.

     Operations available for multiple inputs are

         sum
         mult
         div
         min
         max
         union

     Operations available for a single input file are

         clip
         change
         scale (with bias)

     During execution, data scalars and biases are applied before
     the  requested  operation,  and  inputs are processed in the
     order they apear on the command line. Where samples are live
     in  some  inputs and masked in others, the operation is per-
     formed on only the live samples.

     Using uspmath on the command line, it  may  easier  to  list
     many input file names in a text file and use -F ftap to read
     the list of input names.


ARGUMENTS AND OPTIONS

     -N ntap [default: ntap=stdin:]
          Enter an input data set name immediately  after  typing
          -N.  Repeat as many times as needed for multiple inputs
          (see EXAMPLES). Use the name 'stdin:' if the  first  of
          many inputs is a pipe. For only one piped input, -N may
          be omitted. File  names  should  include  the  relative
          paths if the files reside in different directories.

     -F ftap [default: none]
          Enter the name of a file with input file names (one per
          line). Scalar and bias values for each file can also be
          included, but are optional. The file should  look  like
          this:

               indata_1.usp   -S1 -B0
               indata_2.usp   -S2.5 -B0
                 ...
               indata_n.usp

          If the first file is a pipe, the first name  should  be
          stdin:

     -O otap [default: otap=stdout:]
          Enter the name for the output volume. This name  should
          include  the  relative path if the file is to be placed
          in a different directory.

     -mode mode [default: mode=sum]
          Enter the mode of operation.  (each  operation  follows
          scaling)

            For multiple inputs, select
              sum    - sum inputs
              mult   - multiply inputs
              div    - divide inputs
              min    - take minimum of inputs
              max    - take maximum of inputs
              union  - create union of live samples

            For a single input, select
              clip   - clip live samples to range
                         -min:-max
              change - change one value to another
                         -old --> -new
              scale  - apply scalar and bias only


     -S scalar [default: scalar=1.0]
          The scalar to apply to an input dataset. Repeat as many
          times  as  needed  for  multiple inputs (see EXAMPLES).
          Scalar input should  be  ordered  to  match  the  input
          dataset that the scalar is applied to.

     -B bias [default: bias=0.0]
          The bias to apply to an input dataset. Repeat  as  many
          times  as  needed  for  multiple inputs (see EXAMPLES).
          Bias input should be ordered to match the input dataset
          that the bias is applied to.

          Scalar, bias and operation are applied to input data as
          follows:
            output = operation( input(1)*scalar(1) + bias(1),
                                input(2)*scalar(2) + bias(2),
                                            .
                                            .
                                            .
                                input(n)*scalar(n) + bias(n) )



     -eps eps [default: eps=0.0]
          -eps is added to all inputs when -mode is 'div'. It  is
          ignored for all other modes.

     -min min,  -max max [default: min=-1.0e+37, max=+1.0e+37]
          When -mode is 'clip', live samples less than  -min  are
          set  to -min and live samples greater than -max are set
          to -max.

     -old old,  -new new [default: old=-1.0e+37, new=-1.0e+37]
          When -mode is 'change', samples  with  the  value  -old
          will  be  changed to have the value -new. In this mode,
          the embedded mask  is  used  during  scaling  and  bias
          application but not during the change operation.

     -emask emask [default: emask=-1.0e+37]
          An embedded  mask.  Samples  with  this  value  do  not
          undergo scaling, bias or operation.

     -nomask [default: .FALSE.]
          Use -nomask speed operation when there is  no  embedded
          mask in the data.

     -V [default: .FALSE.]
          Enter -V to enable verbose printout.

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


EXAMPLES

         uspmath -Nin1.usp -Nin2.usp -Nin3.usp \
                 -S0.5 -S1.0 -S0.5 -Oout.usp \
                 -mode sum -nomask -V

     This will add 3 datasets together with weights 0.5, 1.0, and
     0.5. uspmath will ignore any embedded mask if present.

         uspmath -Nstdin: -Nin2.usp -Nin3.usp \
                 -Oout.usp -mode sum -emask -99999 -V

     This will add 3 datasets together. The first dataset is on a
     pipe. The emmbedded mask -99999 is preserved in the output

         uspmath -Nin1.usp -Nin2.usp -Nin3.usp \
                 -eps0.0001 -Oout.usp \
                 -mode div -emask -99999 -V

     This will perform (in1+eps)/(in2+eps)/(in3+eps) where sample
     values are not equal to -99999

         uspmath -Nin1.usp -Nin2.usp -Oout.usp \
                 -mode union -emask 0

     This will create a union of live values  in  the  two  input
     datasets.  Where  both  datasets  are live, the value in the
     first dataset is taken.

         uspmath -Nin.usp -Oout.usp -emask-99999 \
                 -mode change -old -99999 -new 0

     This will change the embedded mask of the input from  -99999
     to 0.


BUGS

     Multiple inputs work on comand line but not within ikp.


AUTHOR

     M.J. O'Brien - Allied Geophysics, Inc.




COPYRIGHTS

     Copyright  2001,  Allied  Geophysics,   Inc.    All   Rights
     Reserved.

     Portions of this application are also protected as follows:

     copyright 2001, Amoco Production Company
               All Rights Reserved
          an affiliate of BP America Inc.
















Man(1) output converted with man2html