#!/bin/bash

EXPORTPATH="/esarchive/scratch/avilanova/software/NES"
SRCPATH="/esarchive/scratch/avilanova/software/NES/tests"
EXE="3-test_spatial_join.py"

module purge
module load Python/3.7.4-GCCcore-8.3.0
module load netcdf4-python/1.5.3-foss-2019b-Python-3.7.4
module load cfunits/1.8-foss-2019b-Python-3.7.4
module load xarray/0.17.0-foss-2019b-Python-3.7.4
module load pandas/1.2.4-foss-2019b-Python-3.7.4
module load mpi4py/3.0.3-foss-2019b-Python-3.7.4
module load filelock/3.7.1-foss-2019b-Python-3.7.4
module load pyproj/2.5.0-foss-2019b-Python-3.7.4
module load eccodes-python/0.9.5-foss-2019b-Python-3.7.4
module load geopandas/0.8.1-foss-2019b-Python-3.7.4
module load Shapely/1.7.1-foss-2019b-Python-3.7.4

for nprocs in 1 2
do
    JOB_ID=`sbatch --ntasks=${nprocs} --exclusive --job-name=nes_${nprocs} --output=./log_nord3v2_NES_${nprocs}_%J.out --error=./log_nord3v2_NES_${nprocs}_%J.err -D . --time=02:00:00 --wrap="export PYTHONPATH=${EXPORTPATH}:${PYTHONPATH}; cd ${SRCPATH}; mpirun --mca mpi_warn_on_fork 0 -np ${nprocs} python ${SRCPATH}/${EXE}"`
done