# ==========================
# ====
# ==== Compute various numbers of K-Cluster for each month and season
# ==== Moreno-Chamarro, June 2018
# ====
# ==========================

# ==== LOAD PACKAGES
# ==== bsceslogin1
#module load R/3.2.0-foss-2015a-bare
#module load CDO/1.9.0-foss-2015a
# ==== POWER9
module load R/3.5.0-foss-2018b
module load CDO/1.9.4-foss-2018b
module load s2dverification/2.8.3-foss-2018b-R-3.5.0

for exp in `cat list-exps-fm-sitCats.dat`; do
    echo $exp
    while IFS=" " read -r seas1 seas2; do
        cdo -s yearmean -selyear,1979/2014 -selmon,$seas2 -selvar,siconc_$exp datasets/sic-temp-sims-fm.1deg.mm.nc.orig sic-sim.temp.1deg.$exp.$seas1.nc
        Rscript --vanilla clusters-all-seasons-undetrend-sims.R  sic-sim.temp.1deg.$exp.$seas1.nc $seas1 $exp
    done < "list-seas-short-selection.dat"
done

mv anom*.nc sic-cluster*.nc tempclusters/.

