#!/bin/sh
set -e

#                  meanvarz            sk - oct 11/00 - rewrite for new timavg/zonavg
#   ---------------------------------- produce time and zonal means and variances.
#
#
#   Usage: meanvarz x  tx txp2 ztx ztxp2 zxs2
#          Input file:
#            x     ($1) = gridded (multi-level) data.
#          Output files:
#            tx    ($2) = time average of x,
#            txp2  ($3) = temproal variance (time average of (x-tx)**2),
#            ztx   ($4) = zonal average of tx
#            ztxp2 ($5) = zonal average of txp2
#            zxs2  ($6) = stationary eddies (zonal average of (tx-ztx)**2)
#
#  This script is obsolete. 'timavg' + 'zonavg' should be used instead.

      if [ $# -ne 6 ]; then 
	echo "menavarz: invalid number of arguments." 
	exit -1
      fi
      timavg $1 $2 _ $3
      zonavg $2 $4 _ $6
      zonavg $3 $5
#   ....................................................................meanvarz
