#
# Driver script for PE_initial runs.

unset noclobber

set datestr = `date`

#-------------------------
#--- Assimilation Run. ---
#-------------------------

#echo " "

#echo "Starting time (assimilation):"
#echo " "
#date
#echo " "

#nice +5 /home/projects2/AOSN2/Bin_Sun5/pe_initst < pi_ass.in > pi_ass.log

#echo " "
#echo "Ending time (assimilation):"
#echo " "
#date

#---------------------------
#--- Reset Error Fields. ---
#---------------------------

echo " "

echo "Starting time:"
echo " "
date
echo " "

matlab<<EIEIO
%
% Reset Matlab path.
%
path('../Matlab',path);
path('../../Matlab',path);
p = path;
pnew = '';

while ~isempty(p)
   ind = findstr(':',p);
   if isempty(ind)
      pwk = p;
      p = '';
    else
      pwk = p(1:ind(1));
      p(1:ind(1)) = [];
   end;

   if isempty(findstr('afmis',pwk))
      pnew = [pnew pwk];
   end;
end;

clear ind p pwk;

path(pnew);

clear pnew
%
% Reset assimilation errors for boundary assimilation.
%
bndy_ass_out

clear
%
% Reset transport streamfunction assimilation errors
% to constants along coastal segments.
%
trans_ass

clear
exit
EIEIO

echo " "
echo "Ending time:"
echo " "
date

/bin/rm pi_icon_bndyass.nc

#-------------------
#--- Make Plots. ---
#-------------------

PlotJob > PlotJob.log

#--------------------------
#--- Reset Protections. ---
#--------------------------

chmod g+w *
chmod go+r *

#----------------------------
#--- Announce Completion. ---
#----------------------------

Mail haley <<EIEIO

JOB DONE


The first AOSN-II PE_initial job submitted to
`hostname` on $datestr is now complete.
Please examine the gmeta files in the directory

   $cwd

Thanks

Pat
EIEIO
