#!/bin/tcsh
#
# Copy tar files of benchmark results (history files and/or post-processing)
# from /glade, and extract them here.
#
set mycwd = `pwd`
set ysdir = yellowstone.ucar.edu:/glade/p/hao/tgcm/tiegcm2.0/benchmarks

set types = ( \
  proc        \
# hist        \
)

set bmdirs = (              \
  tiegcm_res5.0_climatology \
  tiegcm_res5.0_seasons     \
  tiegcm_res5.0_storms      \
  tiegcm_res2.5_climatology \
  tiegcm_res2.5_seasons     \
  tiegcm_res2.5_storms      \
)

foreach bmdir ($bmdirs)
  if (! -d $bmdir) mkdir $bmdir
  cd $bmdir
  echo ' '
  echo Moved to $bmdir

  echo Copying tar files from $ysdir/$bmdir
  scp $ysdir/$bmdir/\*.tar . || echo ">>> Error copying tar files from  $ysdir/$bmdir/"

  foreach tarfile (*.tar)
    echo "  Extracting $tarfile"
    tar xf $tarfile
  end # foreach tarfile
  cd $mycwd
end # foreach bmdir
