#! /bin/csh -fx

#set files = ( b.e12.B1850.f09_g16.PIMP4-pliomip2.ccsm4 )
set files = ( b.e12.B1850.f09_g16.PIMP4-pliomip2.modMed )
set filecntl = ( b.e12.B1850C5CN.f09_g16.preind.ccsm4 )
#set filecntl = ( b.e21.B1850.f09_g17.CMIP6-piControl.001 )
#set filecntl = ( obs )
#set filecntl = ( b40.plio.FV1.003ext )
#set filecntl = ( b40.1850.track1.1deg.006 )
set dir_lnd = ( ccsm4_pliomip2 )
#set dir_lnd = ( cesm2 )
set amwg_yrtag = ( yrs1051-1100 )
#set amwg_yrtag = ( yrs790-840 )
#set dir_atm = ( diag_pliomip2_ccsm4 )
#set dir_atm = ( diag_pliomip2_cesm2 )
set dir_atm = ( diag_PlioMIP2_ccsm4 )

set looper = 1
foreach file ( ${files} )
#  	scp ranfeng@cheyenne.ucar.edu:/glade/p/cesm/palwg_dev/pliocene/imwg/diag/${file}-$filecntl[$looper]/${file}-$filecntl[$looper].tar ./imwg
#   	cd ./imwg 
#   	tar -xvf "${file}-$filecntl[$looper].tar"
#   	rm ${file}-$filecntl[$looper].tar
#   cd ../
#   	scp ranfeng@cheyenne.ucar.edu:/glade/p/cesm/palwg_dev/pliocene/lmwg/$dir_lnd[$looper]/${file}/${file}-$filecntl[$looper].tar ./lmwg/ccsm2
#   	scp -r ranfeng@cheyenne.ucar.edu:/glade/p/cesm/palwg_dev/pliocene/archive/b.e12.B1850.f09_g16.PIMP4-pliomip2.ccsm4/lnd/proc/diag/b.e12.B1850.f09_g16.PIMP4-pliomip2.ccsm4.1000_1099-b.e12.B1850C5CN.f09_g16.preind.ccsm4.80_179 ./lmwg/ccsm2/
#   	cd ./lmwg/ccsm2 
#   	tar -xvf "${file}-$filecntl[$looper].tar"
#   	rm ${file}-$filecntl[$looper].tar
#  cd ../../
#       scp -r ranfeng@cheyenne.ucar.edu:/glade/scratch/cmip6/archive/b.e21.B1850.f09_g17.PMIP4-midPliocene-eoi400.001/lnd/proc/diag/b.e21.B1850.f09_g17.PMIP4-midPliocene-eoi400.001-obs.51_100 ./lmwg/ccsm2
#         cd ../../
#        scp -r ranfeng@cheyenne.ucar.edu:/glade/p/cesm/palwg_dev/pliocene/amwg/$dir_atm[$looper]/${file}/$amwg_yrtag[$looper]/${file}-$filecntl[$looper] ./amwg
#     	cd ./amwg
#    	tar -xvf "${file}-$filecntl[$looper].tar"
#    	rm ${file}-$filecntl[$looper].tar
   cd ../
#       scp -r ranfeng@cheyenne.ucar.edu:/glade/scratch/cmip6/archive/b.e21.B1850.f09_g17.PMIP4-midPliocene-eoi400.001/atm/proc/diag/b.e21.B1850.f09_g17.PMIP4-midPliocene-eoi400.001-obs.51_100 ./amwg
#         cd ../../
#        scp -r ranfeng@cheyenne.ucar.edu:/glade/p/cesm/palwg_dev/pliocene/amwg/$dir_atm[$looper]/${file}/$amwg_yrtag[$looper]/${file}-$filecntl[$looper] ./amwg
#         mv ./omwg/${file}/pdts ./omwg/${file}/pdts.old
#	 mkdir -p ./omwg/${file}/pdts
#         scp ranfeng@cheyenne.ucar.edu:/glade/p/cesm/palwg_dev/pliocene/omwg/${file}/pdts/\{\*.html,\*.txt,\*.asc,\*.gif,\*.ps\} omwg/${file}/pdts/
#  cd ../
#            mv ./OMWG/${file}/  ./OMWG/${file}.old
            mkdir -p ./OMWG/${file}/
            scp ranfeng@cheyenne.ucar.edu:/glade/scratch/ranfeng/OMWG/b.e12.B1850.f09_g16.PIMP4-pliomip2.modMed/ocn/proc/climo.1150.1199/\{\*.html,\*.gif\} ./OMWG/${file}/
#@ looper = ${looper} + 1
end
