#!/usr/bin/ksh # # call_wget_gmag.ksh - This script sets the arguments # to the script which downloads gmag data # # July 19, 2013 clrussell@igpp.ucla.edu # This script handles all ground based magnetometer networks that retrieve # gmag data using a wget. Previously there were scripts for each network. The # scripts have been combined into this one generic wget script. Currently # networks that use wget include, usgs, maccs, lrv, intermagnet, greenland, and # antarctica. This is not a difinitive list and may change. # # NB: it is intended that this script be run on gaia2 as the wget log file # formats differ between machines and wget_intermagnet_gmag relies on # information within the log file. # ## 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 # ## Determine dates to check # thisYear=$(date -u '+%Y') thisMonth=$(date -u '+%m') integer ithisMonth=$thisMonth integer ilastMonth=$(( ithisMonth - 1 )) if (( $ilastMonth <= 0 )) then lastMonth=12 lastYear=$(( $thisYear - 1 )) else lastYear=$thisYear lastMonth=$(echo $ilastMonth | awk '{printf("%02d",$1)}') fi thisYearMonth=${thisYear}_${thisMonth} lastYearMonth=${lastYear}_${lastMonth} # ## Step through each network # for line in $(cat ${CONFIGDIR}/wget_network_list.txt) do network=$(echo $line awk -F_ '{print1}') netfull=$(echo $line awk -F_ '{print2}') # ## Step through dates/schools # for yearMonth in $thisYearMonth $lastYearMonth do year=$(echo $yearMonth | awk -F_ '{print $1}') month=$(echo $yearMonth | awk -F_ '{print $2}') # Now step through each station for line in $(cat ${CONFIGDIR}/${netfull}_list.txt) do site=$(echo $line | awk -F_ '{print $2}') wget_gmag.ksh $network $site $year $month done done done # ## Clean up # exit 0