Newer
Older
#check config file syntaxis problems
sed -i -e 's/= /=/g' ${config_file}
pabretonniere
committed
export WORKDIR
FACTOR=$((NFRP*3600))
ENSEMBLE=${#MEM_LST[@]}
pabretonniere
committed
if [[ $ENSEMBLE -eq 0 ]]; then
MEM_LST=( $( ls ${DATADIR}/${EXPID}/${SDATE} ) )
ENSEMBLE=${#MEM_LST[@]}
echo "Warning: you passed an empty member list. By default, it will treat all the available members: " ${MEM_LST[@]}
fi
LISTMEMB=( $(echo ${MEM_LST[@]} | sed -e 's/fc//g') ) #member list without "fc"
echo ${MEM_LST[0]}
#LISTMEMB=( "$(echo ${MEM_LST[@]} | sed -e 's/fc//g')" ) #member list without "fc"
echo $LISTMEMB
echo ${LISTMEMB[0]}
echo ${LISTMEMB[${#LISTMEMB[@]}-1]}
echo ${#LISTMEMB[@]}
#rm -rf ${WORKDIR}
mkdir -p ${WORKDIR}
if [[ ! -d ${WORKDIR} ]]; then
exit 1
fi
cd ${WORKDIR}
base_path=${DATADIR}/${EXPID}/${SDATE}
mkdir -p ${SAVEDIR}/${EXPID}; # chmod -R 775 $SAVEDIR/${EXPID}
pabretonniere
committed
#exit stop
get_leadtime
header $SDATE
extract
if [ -z ${VAR_LST_2D[@]} ]; then
pabretonniere
committed
# GG=$(ls *GG* | head -1)
GG="$(find . -maxdepth 1 -name "*GG*" | head -1 | sed -e 's/\.\///g' )"
pabretonniere
committed
# SH=$(ls *SH* | head -1)
SH="$(find . -maxdepth 1 -name "*SH*" | head -1 | sed -e 's/\.\///g' )"
read_vars $SH SH
rm /scratch/${USER}/pp/VAR_LST_2D.txt
pabretonniere
committed
VAR_LST_2D=$(echo ${VAR_LST_2D_GG} ${VAR_LST_2D_SH})
echo $VAR_LST_2D >> /scratch/${USER}/pp/VAR_LST_2D.txt
rm /scratch/${USER}/pp/VAR_LST_3D.txt
pabretonniere
committed
VAR_LST_3D=$(echo ${VAR_LST_3D_GG} ${VAR_LST_3D_SH})
else
VAR_LST_3D_SH_DEFAULT='T U V W Z'
VAR_LST_3D_GG_DEFAULT='Q CC CIWC CLWC'
VAR_LST_2D_GG_DEFAULT='T2M D2M SSTK MSL PRECIP SSR STR TTR TSR TSRC TTRC SLHF SSHF U10M V10M SSRD CP SF E SSRU SSRC STRU STRD TCC'
#if list of variables read from config_file, separation between GG and SH variables
for var in ${VAR_LST_3D[@]}
do
for var_sh in ${VAR_LST_3D_SH_DEFAULT[@]}
do
pabretonniere
committed
[ $var == $var_sh ] && VAR_LST_3D_SH=$(echo $VAR_LST_3D_SH $var)
done
for var_gg in ${VAR_LST_3D_GG_DEFAULT[@]}
do
pabretonniere
committed
[ $var == $var_gg ] && VAR_LST_3D_GG=$(echo $VAR_LST_3D_GG $var)
done
done
for var in ${VAR_LST_2D[@]}
do
for var_gg in ${VAR_LST_2D_GG_DEFAULT[@]}
do
pabretonniere
committed
[ $var == $var_gg ] && VAR_LST_2D_GG=$(echo $VAR_LST_2D_GG $var)
echo $YEARF $YEAR0 $MONF - $MON0
surface
combine_3d
regrid2x2
upper
if [[ ${#VAR_LST_MXMN[@]} > 0 ]]; then
maxmin
pabretonniere
committed
#else
# echo "" #empty line to avoid trap issue
fi
cd; rm -rf $WORKDIR # clean up
date
pabretonniere
committed
trap - EXIT
#### End of the Main Part of Script ####