#!/bin/csh -x
#PBS -N proc_032
#PBS -j oe
#PBS -o postproc.log
#PBS -W umask=027
#PBS -l application=hycom
#PBS -l select=1:ncpus=44:mpiprocs=44
#PBS -l place=scatter:excl
#PBS -l walltime=00:45:00
#PBS -A ONRDC10855122
#PBS -q standard 


## get the mean year archive
# directory where the monthly means are
setenv S /p/work/abozec/HYCOm-examples/GOMb0.01/expt_01.0/data/meanstd

# make sure to have the grid and depth file in the same directory
ln -s ${S}/../regional.grid.* ${S}
ln -s ${S}/../regional.depth.* ${S}

setenv E 010
cd ${S}/
setenv Y 2001
setenv KDM 41
 
cat <<E-o-D  > file_mean.IN
 ${KDM}    'kk    ' = number of layers involved
  0        'meansq' = form meansq, rather than mean (0=F,1=T)
  12        'narchs' = number of archives to read (==0 to end input)
${E}_archm.${Y}_m01.a
${E}_archm.${Y}_m02.a
${E}_archm.${Y}_m03.a
${E}_archm.${Y}_m04.a
${E}_archm.${Y}_m05.a
${E}_archm.${Y}_m06.a
${E}_archm.${Y}_m07.a
${E}_archm.${Y}_m08.a
${E}_archm.${Y}_m09.a
${E}_archm.${Y}_m10.a
${E}_archm.${Y}_m11.a
${E}_archm.${Y}_m12.a
  0     'narchs' = number of archives to read (==0 to end input)
${E}_archm.${Y}
E-o-D

cp ~/HYCOM-tools/MPI/meanstd/src/hycom_mnsq .
cp file_mean.IN blkdat.input
aprun -n 44  ./hycom_mnsq


