year=2010
ncks=/cluster/gcc-4.8.5/tools/bin/ncks
path=/data3/data/HYCOM/hindcasts/GLBv0.08/2010/ssh

for i in {12..12..01}
do
mkdir -p ${path}/${i}

  vv=536

rm -rf ${path}/${i}/record.txt

cd ${path}/${i}
  for j in {31..31..01}
  do
    for k in {00..18..06}
    do
    file=hycom_ssh_2010${i}${j}12_t0${k}.nc
    panosize=`ls -l ${file} |cut -d ' ' -f 5`
    if [[ ! -f ${file} ]] || [[ ${panosize} -le 29000000 ]];then
      ${ncks} -v surf_el ${path}/../${i}/hycom_GLBv0.08_${vv}_2010${i}${j}12_t0${k}.nc hycom_ssh_2010${i}${j}12_t0${k}.nc
    fi

    if [ -f ${file} ]; then
      echo "${i}${j}_t0${k} ok" >> record.txt
    else
      echo "${i}${j}_t0${k} false" >> record.txt
    fi
    done
  done
done

