#!/bin/bash


if [ $BSC_MACHINE = mn4 ]; then
    # Environment for MN4 
    module load python/3.6.1
    module load netcdf/4.2
    module load CDO/1.9.3
    module list
    export MPIRUN="mpirun"
    export PYTHONPATH=""
    echo "MN4 modules are loaded"

elif [ $ECPLATFORM = hpc2020 ]; then
    # Environment for HPC2020
    module reset
    #module load python3/3.8.8-01 prgenv/intel intel/2021.4.0 intel-mkl/19.0.5 hpcx-openmpi/2.9.0 hdf5-parallel/1.10.6 netcdf4-parallel/4.7.4 cdo
    module load python3/3.10.10-01 prgenv/intel intel/2021.4.0 hpcx-openmpi/2.9.0 hdf5-parallel/1.12.2 netcdf4-parallel/4.9.1 cdo 
    module list
    export MPIRUN="mpirun -oversubscribe"
    export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${NETCDF4_PARALLEL_DIR}/lib:${ECCODES_DIR}/lib:${HDF5_DIR}/lib"
    echo LD_LIBRARY_PATH: $LD_LIBRARY_PATH
    echo "HPC2020 modules are loaded"

else 
    echo "Error: Platform is unkown, could not load required moduleds."
    exit 1

fi 