#!/usr/bin/env csh
#
# c-shell script to download selected files from rda.ucar.edu using Wget
# NOTE: if you want to run under a different shell, make sure you change
#       the 'set' commands according to your shell's syntax
# after you save the file, don't forget to make it executable
#   i.e. - "chmod 755 <name_of_script>"
#
# Experienced Wget Users: add additional command-line flags to 'opts' here
#   Use the -r (--recursive) option with care
#   Do NOT use the -b (--background) option - simultaneous file downloads
#       can cause your data access to be blocked
set opts = "-N"
#
# Check wget version.  Set the --no-check-certificate option 
# if wget version is 1.10 or higher
set v = `wget -V |grep 'GNU Wget ' | cut -d ' ' -f 3`
set a = `echo $v | cut -d '.' -f 1`
set b = `echo $v | cut -d '.' -f 2`
if(100 * $a + $b > 109) then
  set cert_opt = "--no-check-certificate"
else
  set cert_opt = ""
endif

set filelist= ( \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072300.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072306.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072312.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072318.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072400.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072406.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072412.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072418.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072500.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072506.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072512.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072518.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072600.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072606.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072612.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072618.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072700.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072706.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072712.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072718.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072800.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072806.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072812.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072818.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072900.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072906.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072912.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024072918.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024073000.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024073006.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024073012.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024073018.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024073100.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024073106.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024073112.f00.grib2  \
  https://data-osdf.rda.ucar.edu/ncar/rda/d083003/2024/202407/gdas1.fnl0p25.2024073118.f00.grib2  \
)
while($#filelist > 0)
  set syscmd = "wget $cert_opt $opts $filelist[1]"
  echo "$syscmd ..."
  $syscmd
  shift filelist
end
