# #!/bin/bash
source /home/bsc/bsc032413/.bashrc
module load R/4.1.2-foss-2019b
module load Python/3.7.3-foss-2015a
module load \
              jupyterlab/3.0.9-foss-2019b-Python-3.7.4 \
              xarray/0.19.0-foss-2019b-Python-3.7.4 \
              Cartopy/0.18.0-foss-2019b-Python-3.7.4 \
              basemap/1.2.1rel-foss-2019b-Python-3.7.4 \
              pandas/1.2.4-foss-2019b-Python-3.7.4 \
              scikit-learn/0.24.2-foss-2019b-Python-3.7.4 \
              netcdf4-python/1.5.3-foss-2019b-Python-3.7.4 \
              HDF5/1.10.5-gompi-2019b \
              R/3.6.2-foss-2019b
module load OpenMPI/4.0.5-GCC-8.3.0-nord3-v2

today=$(date +"%A")
if [ "$today" == "Thursday" ]; then
    current_date=$(date +"%Y%m%d")
elif [ "$today" == "Friday" ]; then
    current_date=$(date -d "yesterday" +"%Y%m%d")
fi
echo "Current date: $current_date"

Rscript /esarchive/scratch/ptrascas/R/sunset/scripts/oper_heat_i4c_plotforecastpdf.R $current_date

vars=('t2' 't02min' 't02max')

source /esarchive/scratch/lpalma/git/vitigeoos-prod/data-analysis/PYTHON_MODULES
cd /esarchive/scratch/ptrascas/R/sunset

for var in t2 t02min t02max
  do python /esarchive/scratch/ptrascas/R/sunset/scripts/vitigeoss_plots.py subseasonal $current_date $var
done

for var in t2 t02min t02max
  do python /esarchive/scratch/ptrascas/R/sunset/vitigeoss_plots.py subseasonal $current_date $var
done



