#!/usr/bin/ksh # # call_wget_green_gmag.ksh - This script sets the arguments # to the script which downloads GREEN gmag data # # 13 May 2010 Pat Cruce(pcruce@igpp.ucla.edu) # Based Heavily on call_wget_maccs_gmag.ksh by Tim Quinn(teq@ssl.berkeley.edu) # # This routine is intended for use downloading backfiles - it downloads to the normal # data location, simply using a local config file to set dates # ## 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 #. ${THMSOC}/src/config/wget_green_gmag.config . /home/thmsoc/lphilpotts_stuff/greenland_test/wget_green_gmag_backfiles.config # ## Function Definitions # # ## Determine dates to check # #current date in seconds currentSecs=$(date -u +%s) #start date ((startSecs=currentSecs-60*60*24*(DAYSTOCHECK+DAYSOFLAG))) ((day = 0)) #loop over days of interest while ((day < DAYSTOCHECK)) do ((secs = startSecs+day*60*60*24)) year=$(date --date="1970-01-01 UTC $secs seconds" -u +%Y) mon=$(date --date="1970-01-01 UTC $secs seconds" -u +%m) date=$(date --date="1970-01-01 UTC $secs seconds" -u +%d) for line in $(cat ${CONFIGDIR}/green_site_list_new.txt | awk '{print $2}') do site=$(echo $line) #echo $site $year $mon $date ksh /home/thmsoc/lphilpotts_stuff/greenland_test/wget_green_gmag_backfiles.ksh $site $year $mon $date done ((day=day+1)) done # for year in $thisYear $lastYear # do # for line in $(cat ${CONFIGDIR}/maccs_site_list.txt) # do # site=$(echo $line |awk -F_ '{print $2}') # wget_maccs_gmag.ksh $site $year # done # done # ## Clean up # exit 0