Sample PSPT Access Script

#!/bin/ksh
#
# Usage 1: getdata yyyy mm dd hh -1 -1 -1 -1 R
#      where -1 signifies end date/time = start date/time
# Usage 2: getdata yyyy mm dd hh -1 -1 -1 hh R
#       or getdata yyyy mm dd hh yyyy mm dd hh R
# etc.
#
# REQUIRES curl utility
#

CURL=$(which curl)

if [[ ! -x $CURL ]] ; then
    print -u2 "Unable to locate 'curl' command in your PATH."
    return 1
fi

# Set up url parameters

styr=$1
stmo=$2
stdy=$3
stut=$4
enyr=$5
enmo=$6
endy=$7
enut=$8
fltr=$9

url="http://lasp.colorado.edu/pspt_access/cgi-bin/access.cgi\
?StartYear=$styr&StartMonth=$stmo&StartDay=$stdy&EndYear=$enyr\
&EndMonth=$enmo&EndDay=$endy&StartUT=$stut&EndUT=$enut&FilterWheel=\
$fltr&format=text"

for fname in $($CURL $url)
  do $CURL "http://lasp.colorado.edu/$fname" -o $(basename $fname)
done

return 0

Last modified: Fri Jun 1 18:12:13 MDT 2007