#!/bin/csh

set month  = $2
set day = $3
set year   = $4
set network = $1
set today = $month$day

if ($#argv != 4) then
    echo ""
    echo "Usage: "
    echo "     hid_only  Network Month Day Year "
    echo ""
    echo "     nnnn = Network (GPMVN, TRMMVN, GCOMW1, KMLB, KWAJ, NPOL, KDOX, KAKQ)"
    echo "     mm = month (ex. 01)"
    echo "     dd = day (ex. 12)"
    echo "     yyyy = year (ex. 2012)"
    echo ""
    exit
endif

if ( $network == 'NPOL') then
echo " Please enter Field Campaign (IPHEX, IFLOODS, OLYMPEX, Newark)?"
set req = $<
foreach j (ppi pps rhi)
if ( $req == 'IPHEX' || $req == 'IFLOODS') then
idl<<EOF
  hid_only,'$network',$year,$month,$day,/apply_blockage,/DPQC,field_campaign='$req',scantype='$j'
EOF
else
idl<<EOF
  hid_only,'$network',$year,$month,$day,/DPQC,field_campaign='$req',scantype='$j'
EOF
endif
end
else
idl<<EOF
  hid_only,'$network',$year,$month,$day,/DPQC
EOF
endif 

cd ./output/$year/

if ( $network == 'NPOL') then
foreach k (ppi pps rhi)
set subhead=$network' DROPS2, HID, DSD processing '$today$year' '$k
set outfile=$network'_'$k'_'$today'.txt'
mail -s "`echo $subhead`" jason.l.pippitt@nasa.gov < $outfile
end
else
set subhead=$network" DROPS2, HID, DSD processing "$today$year
set outfile=$network'_'$today'.txt'
mail -s "`echo $subhead`" jason.l.pippitt@nasa.gov < $outfile
endif
