#!/bin/csh
#
# Set first and last file numbers to acquire:
#
@ i0 = 36
@ i1 = 120
#
# set the user ID and password for COSMIC data;
#
set user_give=luanxl
set password_give=luanxl
#
@ nfiles = ($i1 - $i0) + 1
echo "Will acquire $nfiles files (${i0} to ${i1}):"
@ ifile = $i0
@ n = 1
while ($ifile <= $i1) 
  if ($ifile <= 9) then
    set num = "00${ifile}"
  else if ($ifile <= 99) then
    set num = "0${ifile}"
  else 
    set num = "${ifile}"
  endif
#
#  wget   -r  -l 1 -np --http-user=$user_give --http-password=$password_give http://cosmic-io.cosmic.ucar.edu/cdaac/login/cosmicrt/level2/ionPrf/2013.$num -nH --cut-dirs=5
tar -xvf 2014.$num
#wget   -q -r  -l 1 -np --http-user=$user_give --http-password=$password_give http://cdaac-www.cosmic.ucar.edu/cdaac/rest/tarservice/data/champ2014/ionPrf/2007.$num -nH --cut-dirs=5
#wget  -q  -r  -l 1 -np --http-user=$user_give --http-password=$password_give http://cdaac-www.cosmic.ucar.edu/cdaac/rest/tarservice/data/cosmic/ionPrf/2013.$num -O cosmic_ionPrf-2013.$num -nH --cut-dirs=5
#
  echo "n=$n of ${nfiles}"
#
  @ ifile++
  @ n++
end # while $ifile <= $ifile
