#!/bin/ksh
################################################################################
####  UNIX Script Documentation Block
#                      .                                             .
# Script name:        exnam_smartinit_ak.sh.sms 
# Script description:  Runs NAM smartinit codes over Alaska 
#
# Author:        Bradley Mabe       Org: NP11         Date: 2007-08-23
#
# Abstract: This script runs the Nam  Smart Init jobs
#
# Script history log:
# 2007-12-28  Geoff Manikin -  revised script for Alaskan domain 
# 2011-07-05  Geoff Manikin -  revised script to use the AK nest for
#             the first 60 hours and then the parent NAM for the rest.
#             The nest is only used to F54 for the 06/18z cycles to
#             prevent splitting the 12-hour precip accumulations between
#             nest and parent grids.   This is for the 5.9 km output;
#             a separate script is used to generate the 2.9 km output.
# 2011-07-22  Geoff Manikin -  can't use nest for 00-hr output 
#

set -xa
msg="JOB $job HAS BEGUN"
postmsg "$jlogfile" "$msg"

cd $DATA

  if [ cyc -eq 00 -o cyc -eq 12 ] ; then
    if [ ffhr -le 60 -a ffhr -ne 0 ] ; then
	$USHnam/nam_smartinitaknest_on.sh
    else
        $USHnam/nam_smartinitak_on.sh
    fi
  else
# must stop nest at 54 hours, so that 12-hr totals at
#  f66 aren't split between nest and parent
     if [ ffhr -le 54 -a ffhr -ne 0 ] ; then
	$USHnam/nam_smartinitaknest_off.sh
     else
        $USHnam/nam_smartinitak_off.sh
    fi
  fi

#export err=$?; err_chk

set -x
#####################################################################

echo EXITING $0
exit
#
