#!/bin/sh
###############################################################################
#                                                                             #
# Script Name: estofs_subtidal_water_level.sh                                 #
#                                                                             #
# Technical Contact(s): Name: Yuji Funakoshi       Org: NOS/OCS/CSDL/MMAP     #
#                       Phone: 301-7132809 ext.113                            #
#                       E-Mail: yuji.funakoshi@noaa.gov                       #
#                                                                             #
# Abstract:                                                                   #
# This script is to create sub-tidal water level in fields                    #           
#                                                                             #
# Usage: ./estofs_subtidal_water_level.sh                                     #
#                                                                             #
# Input Parameters:                                                           #
#                                                                             #
# Language:   Bourne Shell Script                                             #
#                                                                             #
# Target Computer: CIRRUS/STRATUS at NCEP                                     #
#                                                                             #
# Estimated Execution Time: < 10 minutes                                      #
#                                                                             #
# Suboutines/Functions Called:                                                #
# Name               Directory Location            Description                #
# estofs_subtidal    /exec                         compute sub-tidal          #
# _water_level                                     water level                #
#                                                                             #
# Input Files:                                                                #
# Name               Directory Location            Descriptioni               #
# swl.ctl            /work                         swl control file           #
#                                                                             #
# Output Files:                                                               #
# Name               Directory Location            Description                #
# YMDH.modID.cwl     /work                         CWL in fields              #
# YMDH.modID.htp     /work                         HTP in fiedls              #
# YMDH.modID.swl     /work                         SWL in fields              #
#                                                                             #
# Libraries Used: see the makefile                                            #
#                                                                             #
# Author Name: Yuji Funakoshi                      Creation Date: Dec, 2011   #
#                                                                             #
# Revisions:                                                                  #
# Date               Author                        Description                #
#                                                                             #
# Remarks:                                                                    #
#                                                                             #
###############################################################################
# Start of estofs_subtidal_water_level.sh script ---------------------------- #
# 1. Set times and loops

  wndh=3
  nowh=6 
  lsth=180

  export date=$PDY
  export YMDH=${PDY}${cyc}

# --------------------------------------------------------------------------- #
# 2.  Create input file 

  rm -f swl.ctl swl.log
  echo cwl.fort.63.nc >> swl.ctl
  echo htp.fort.63.nc >> swl.ctl

# --------------------------------------------------------------------------- #
# 3.  Execute estofs_subtidal_water_level 

  export pgm="estofs_subtidal_water_level"
  prep_step
  startmsg
  $EXECestofs/estofs_subtidal_water_level < swl.ctl > swl.log 2>errfile
  export err=$?; err_chk
  cat fort.81 >> ${YMDH}.${modID}.cwl
  cat fort.82 >> ${YMDH}.${modID}.htp
  cat fort.83 >> ${YMDH}.${modID}.swl
  rm -f fort.81 fort.82 fort.83

# End of estofs_subtidal_water_level.sh script ------------------------------ #
