#!/bin/bash

set -ex

fyear=1780
lyear=1870

for file in /scratch3/esamakin/bc_vf/SST/PaleoSST_1000-1870_R???.nc ; do

  real=$(basename ${file} | sed -e "s/_mod//" -e "s/.*_\(R[0-9]*\).nc/\1/g")

  outfile=PALAEO-RA_T63_${real}_sst_assim_uncor_${fyear}-${lyear}.nc

  cdo -f nc2 setmisstonn -remapdis,PALAEO-RA_T63_real000_sic_cor_trans_1420-1849.nc ${mulc} -selvar,sst -selyear,${fyear}/${lyear} -setcalendar,standard ${file} ${outfile} 

done # file

exit 0
