#!/usr/bin/ksh

## 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/astraea2_test/soc_it_to_me.config
  #. ${THMSOC}/src/config/ground_mag.config
  . /home/thmsoc/astraea2_test/ground_mag_test.config
## Process sites
#
	for line in $(cat ${CONFIGDIR}/lc_site_list.txt)
	do
		site=$(echo $line | awk '{print $1}')
		# had to change 9 to 10 below for testing due to different path to data. No change needed in actual script
		find ${L2MAGDIR}/${site}/ -name \*cdf |awk -F/ '{print $10}' |sort |awk -F_ '{print $5}' >> ${LOCAL}/gmag_cdf_list_${site}.txt
		mv -f ${LOCAL}/gmag_cdf_list_${site}.txt ${FILELISTS}/gmag_cdf_list_${site}.txt
	done

#
## Cleanup
#
	exit 0