#!/bin/ksh
################################################################################
####  UNIX Script Documentation Block
#                      .                                             .
# Script name:        exnam_smartinit_pr.sh.sms 
# Script description:  Runs NAM smartinit codes over Puerto Rico 
#
# 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 Puerto Rico domain 
# 2011-07-05  Geoff Manikin - revised script to use the PR 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.
# 2011-07-22  Geoff Manikin - can't use nest output for F00
#

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

cd $DATA
mkdir $DATA/maxminpr

  if [ cyc -eq 00 -o cyc -eq 12 ] ; then
    if [ ffhr -le 60 -a ffhr -ne 0 ] ; then
	$USHnam/nam_smartinitprnest_on.sh
    else
        $USHnam/nam_smartinitpr_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_smartinitprnest_off.sh
     else
        $USHnam/nam_smartinitpr_off.sh
    fi
  fi

#export err=$?; err_chk

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

echo EXITING $0
exit
#
