#!/bin/csh

if ($#argv != 3) then
        echo "Usage: $0 mm dd yyyy"
        echo "   where"
        echo "     mm = month (ex. 01)"
        echo "     dd = day (ex. 12)"
        echo "     yyyy = year (ex. 2012)"
        exit
endif

 set month = $1
 set day = $2
 set year = $3
 set mday = $month$day


cd /gpmraid/raw/NPOL/temp/ppi/

if(-e /gpmraid/raw/NPOL/temp/ppi/$mday/)then
  mkdir -p /gpmraid/raw/NPOL/Newark/$year/$mday/ppi/
  set ppidir = /gpmraid/raw/NPOL/temp/ppi/$mday/
  echo " "
  echo "Copying PPI " $ppidir 
  mv $ppidir/np1* /gpmraid/raw/NPOL/Newark/$year/$mday/ppi/
  else
  echo " "
  echo "No PPI data for " $mday
endif

cd /gpmraid/raw/NPOL/temp/pps/

if(-e /gpmraid/raw/NPOL/temp/pps/$mday/)then
  mkdir -p /gpmraid/raw/NPOL/Newark/$year/$mday/pps/
  set ppsdir = /gpmraid/raw/NPOL/temp/pps/$mday/
  echo " "
  echo "Copying PPS " $ppsdir
  mv $ppsdir/np1* /gpmraid/raw/NPOL/Newark/$year/$mday/pps/
  else
  echo " "
  echo "No PPS data for " $mday
endif

cd /gpmraid/raw/NPOL/temp/rhi/

if(-e /gpmraid/raw/NPOL/temp/rhi/$mday/)then
  mkdir -p /gpmraid/raw/NPOL/Newark/$year/$mday/rhi/
  set rhidir = /gpmraid/raw/NPOL/temp/rhi/$mday/
  echo " "
  echo "Copying RHI " $rhidir
  mv $rhidir/np1* /gpmraid/raw/NPOL/Newark/$year/$mday/rhi/
  else
  echo " "
  echo "No RHI data for " $mday
endif

cd /gpmraid/raw/NPOL/temp/other/

if(-e /gpmraid/raw/NPOL/temp/other/$mday/)then
  mkdir -p /gpmraid/raw/NPOL/Newark/$year/$mday/other/
  set otherdir = /gpmraid/raw/NPOL/temp/other/$mday/
  echo " "
  echo "Copying other " $otherdir
  mv $otherdir/np1* /gpmraid/raw/NPOL/Newark/$year/$mday/other/
  else
  echo " "
  echo "No other data for " $mday
endif

cd /gpmraid/raw/NPOL/temp/bb/

if(-e /gpmraid/raw/NPOL/temp/bb/$mday/)then
  mkdir -p /gpmraid/raw/NPOL/Newark/$year/$mday/bb/
  set bbdir = /gpmraid/raw/NPOL/temp/bb/$mday/
  echo " "
  echo "Copying BB " $bbdir
  mv $bbdir/np1* /gpmraid/raw/NPOL/Newark/$year/$mday/bb/
  else
  echo " "
  echo "No BB data for " $mday
endif

cd /gpmraid/raw/NPOL/temp/gpm_overpass/

if(-e /gpmraid/raw/NPOL/temp/gpm_overpass/$mday/)then
  mkdir -p /gpmraid/raw/NPOL/Newark/$year/$mday/gpm_overpass/
  set gpmdir = /gpmraid/raw/NPOL/temp/gpm_overpass/$mday/
  echo " "
  echo "Copying gpm_overpass " $gpmdir
  mv $gpmdir/np1* /gpmraid/raw/NPOL/Newark/$year/$mday/gpm_overpass/
  else
  echo " "
  echo "No gpm_overpass data for " $mday
endif



