#!/bin/bash

#SBATCH -J parallel
#SBATCH -o parallel-%J.out
#SBATCH -e parallel-%J.err
#SBATCH -t 7-00:00:00

#SBATCH -w amdahl
#SBATCH -n 5

module load R CDO NCO netCDF GCC HDF5 UDUNITS 

script="/home/Earth/fullano/.../diagnostic.R"

arg1_min=1
arg1_max=12

arg2_min=1
arg2_max=5

arg3_min=
arg3_max=






  start_date = 1:12
  lead_time = 1:5

  ...

  script.arg <- as.integer(commandArgs(TRUE))
             
  if(length(script.arg) > 0){                             
    start_date <- script.arg[1]                                
    lead_month <- script.arg[2]                               
  }                                                       

  for (sd in start_date){
     for (lt in lead_time){
        ######################
        # Your analysis here #
        ######################

       

     }
  }

 
 save(output_1, ... , output_N, file=paste0(workdir,"/my_analysis.RData"))








 save(output_1, ... , output_N, file=paste0(workdir,
             "/my_analysis_start_date_",sd,"_lead_time_",lt,".RData"))

  import sys                                           
  script.arg = int(sys.argv)                               

  if len(script.arg) > 0 :                                 
     start_date = script.arg[1]                                
     lead_month = script.arg[2]                                





