#!/bin/bash
#set -x

yini="1979"
yend="2023"

in="Antarctica-2km" #"Greenland-1km"
exp="BN_RACMO2.3p2_ANT27_ERA5_3h.AIS.2km"   #"BN_RACMO2.3p2_ERA5_3h_FGRN055.1km"  #"BN_RACMO2.3p2_FGRN055_1km"

varlist="smb_rec"

for year in `seq $yini 1 $yend` ; do
for var in $varlist ; do
	gunzip ${in}/${var}.${year}.${exp}.MM.nc.gz
	cdo -f nc4 -z zip_5 copy ${in}/${var}.${year}.${exp}.MM.nc ${in}/${var}.${year}.${exp}.MM-comp.nc
	mv ${in}/${var}.${year}.${exp}.MM-comp.nc ${in}/${var}.${year}.${exp}.MM.nc
done
done
