#!/bin/sh
set -e

#                  xtrans              sk - oct 11/00 - rewrite for new timavg
#   ---------------------------------- calculate x"y" statistics from x" and y.
#
#   Usage: xtrans xp y txpyp [ty]
#          Input files: 
#            xp  ($1) = deviations from the time mean of x (xp=x-tx),
#            y   ($2) = second input file.
#          Output files:
#          txpyp ($3) = covariance (time average of xp*yp),
#          ty    ($4) = (optional) time average of y.
#
#   This script is obsolete. 'timavg' + 'timcov' should be used instead.

      if [ $# -lt 3 ]; then 
	echo "too few arguments."
	exit -1
      fi

      timavg $2 ty. yp.
      timcov $1 yp. $3
      rm yp.

      if [ $# -eq 4 ]; then 
	mv ty. $4
      else 
	rm ty.
      fi
#   ...................................................................... xtrans
