#!/bin/bash

YYYY=1940
SCE=585

YYYY_MAX=2040
fn_suf='MAR_key_variables_'
for c in `seq 1 100`
do
        echo ${YYYY}
	ncks -C -O -x -v __xarray_dataarray_variable__ ${fn_suf}${YYYY}.nc out.nc
	rm -rf ${fn_suf}$${YYYY}.nc
	cdo -f nc4 -z zip_5 copy out.nc ${fn_suf}${YYYY}.nc
	rm -rf out.nc
	if [ $YYYY -eq $YYY_MAX ] ; then
		break
	fi
	
	YYYY=$(( ${YYYY} + 1 ))
	

done
