#!/bin/csh -f
#
# Get data from MSS -- store on /cgd/tss, use mksoftlinks.csh script to link to it here
# as well as creating softlinks for other years
#

set dir = /cgd/tss/NCEPDATA.Qian.T62.c051024
set MSSDir = "/TQIAN/LSMF/NCEPDATA"

set echo
mkdir -p $dir
chmod 2775 $dir
chgrp cseg $dir
unset echo

echo "Get data from $MSSDir to $dir"
msrcp mss:$MSSDir/readme.CLMF $dir/.
if ( $status != 0 )then
   echo "ERROR:: copying files to $dir"
   exit 1
endif
echo "Got readme.LSMF to $dir"
msrcp mss:$MSSDir/'????-??.nc'  $dir/.
if ( $status != 0 )then
   echo "ERROR:: copying files to $dir"
   exit 2
endif
echo "Got actual data to $dir"
echo "change data to read-only"
# Use a loop as shell complains that line is too long otherwise
foreach i ( 01 02 03 04 05 06 07 08 09 10 11 12 )
   chmod 0444 $dir/????-$i.nc
end
echo "Success"
