#!/usr/bin/ksh
#
# call_wget_maccs_gmag.ksh - This script sets the arguments
# to the script which downloads MACCS gmag data
#
# Creation Date:
#
#								21 April 2009 TimQuinn
#
#	

#
## Set the environment variables
#
	if [[ -z $THMSOC ]]
	then
		THMSOC=/disks/socware/thmsoc_dp_current
		export THMSOC
	fi
  #. ${THMSOC}/src/config/soc_it_to_me.config
  . /home/thmsoc/gaia2_test/soc_it_to_me.config
#
## Function Definitions
#


#
## Determine dates to check
#
	thisYear=$(date -u '+%Y')
	thisMonth=$(date -u '+%m')
	if [[ $thisMonth = "01" ]]
	then
		lastYear=$(( $thisYear - 1 ))
	fi

	for year in $thisYear $lastYear
	do
		for line in $(cat ${CONFIGDIR}/maccs_site_list.txt)
		do
			site=$(echo $line |awk -F_ '{print $2}')
			/home/thmsoc/gaia2_test/wget_maccs_gmag_gaia.ksh $site $year
		done
	done

#
## Clean up
#
	exit 0
