set -xuve

reftime="2000-01-01,00:00:00,days"

rm -f tmp_*.nc

for year in 2014
do
    for f in gfas_1x1_${year}??.nc
    do
	yyyy=${f:9:4}
	mm=${f:13:2}
	echo $f $yyyy $mm
	cdo -r -O -setreftime,${reftime} -settaxis,${yyyy}-${mm}-01,00:00:00,1day $f tmp_${yyyy}${mm}.nc
    done
    
    cdo -O -f nc4c -z zip_2 mergetime tmp_??????.nc gfas_1x1_${year}.nc
done
