#!/bin/bash
#===============================================================================
#
#          FILE:  create_experiment.sh
# 
#         USAGE:  ./create_experiment.sh 
# 
#   DESCRIPTION:  
# 
#       OPTIONS:  ---
#  REQUIREMENTS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR:   (), 
#       COMPANY:  
#       VERSION:  1.0
#       CREATED:  15/01/24 16:54:10 EET
#      REVISION:  ---
#===============================================================================

ROOTDIR="$(git rev-parse --show-toplevel)"

ICDIR="$ROOTDIR/nemo/V40/eORCA1_Z75/1985010100"
COMMONDIR="$ROOTDIR/nemo/V40/eORCA1_Z75/common"
XIOSDIR="$ROOTDIR/nemo/V40/eORCA1_Z75/xios"
SCRIPTDIR="$ROOTDIR/scripts"

EXPID=${EXPID:-"`date +%F-%s`"}

EXPDIR="exp-${EXPID}"

NEMOBINDIR="/gpfs/scratch/ehpc01/bsc032655/lab/DestinE/NEMO/nemo-build"
FORCINGDIR="$ROOTDIR/nemo_forcing"

cp -Rs $ICDIR $EXPDIR
cp -Rs $COMMONDIR/* $EXPDIR
cp -Rs $XIOSDIR/* $EXPDIR
rm $EXPDIR/namelist*
cp $ICDIR/namelist* $EXPDIR
cp $SCRIPTDIR/rebuild.slurm $EXPDIR
cp $SCRIPTDIR/nam_grid_U $EXPDIR 
cp $SCRIPTDIR/nam_grid_V $EXPDIR 
cp $SCRIPTDIR/nam_grid_T $EXPDIR 
cp $SCRIPTDIR/nam_icemod $EXPDIR 

for var in precip q10 qlw qsw slp snow t10 u10 v10; do for year in 1985 1986 1987 1988 1989; do ln -s ${FORCINGDIR}/${var}_fc00_ERA5_HRES_eORCA1_Z75_${year}.nc ${EXPDIR}/${var}_y${year}.nc; done; done

ln -s ${NEMOBINDIR}/nemo.bin/nemo $EXPDIR/nemo
ln -s ${NEMOBINDIR}/env.sh $EXPDIR/env.sh

echo $EXPDIR



