#!/bin/csh -f

set CRMe_path		= ../cmip5/
set outpath 		= ./ 

## Loop over available models / select available model

set period = ( "2020-2039" "2040-2059" "2060-2079" "2080-2099" )

set variable = ( heatwavedays95pbcdp spei12severedroughtbcap )

set datapath = ( all-regridded-rcp26-median  all-regridded-rcp26-p10  all-regridded-rcp26-p90  \
				 all-regridded-rcp45-median  all-regridded-rcp45-p10  all-regridded-rcp45-p90  \
				 all-regridded-rcp60-median  all-regridded-rcp60-p10  all-regridded-rcp60-p90  \
				 all-regridded-rcp85-median  all-regridded-rcp85-p10  all-regridded-rcp85-p90  )


foreach var($variable)

	foreach per($period)
	
		foreach file($datapath)
		
		set directory  = {$CRMe_path}{$file}/{$var}/mean/annual/anomaly-{$var}-annual-mean/{$per}/
		set sourcefile = anomaly-{$var}-annual-mean_cmip5_annual_{$file}_{$per}.nc
		echo 'cp file : '{$directory}{$sourcefile}
		echo 'to : '{$outpath}{$sourcefile}
		cp {$directory}{$sourcefile} {$outpath}{$sourcefile}
		end
	end
end
