#!/bin/bash

inpYear=$1
inpMonth=$2
inpDay=$3
inpHour=$4

startDate="${inpYear}-${inpMonth}-${inpDay} ${inpHour}:00:00"
echo "start date = $startDate"
echo " "

for m in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
do
Year=$(date --date="${startDate} ${m}hours" "+%Y")
Month=$(date --date="${startDate} ${m}hours" "+%m")
Day=$(date --date="${startDate} ${m}hours" "+%d")
Hour=$(date --date="${startDate} ${m}hours" "+%H")

dateTxt="${Year}-${Month}-${Day}_${Hour}:00:00"
#echo "date = $dateTxt"
filenm="wrfchemi_d01_${dateTxt}"
#echo "File = $filenm"
#command="ncbo --op_typ=add sector/${filenm} stack/${filenm} total/${filenm}"
ncbo --op_typ=add sector/${filenm} stack/${filenm} total/${filenm}
#echo $command
done

exit 0
