#!/bin/bash
#SBATCH --job-name=obj
#SBATCH --output=/home/ajohns14/obj.o%j
#SBATCH --error=/home/ajohns14/obj.e%j
#SBATCH --ntasks=1
#SBATCH --ntasks-per-node=1
###SBATCH --exclusive
#SBATCH --workdir=/scratch/ajohns14
#SBATCH -p map
#SBATCH --time=15:00:00 


rundirall[1]=/scratch/ajohns14/rundir/uh
rundirall[2]=/scratch/ajohns14/rundir/uh
rundirall[3]=/scratch/ajohns14/rundir/uh
rundirall[4]=/scratch/ajohns14/rundir/uh
rundirall[5]=/scratch/ajohns14/rundir2/uh
rundirall[6]=/scratch/ajohns14/rundir2/uh
rundirall[7]=/scratch/ajohns14/rundir2/uh
rundirall[8]=/scratch/ajohns14/rundir2/uh
rundirall[9]=/scratch/ajohns14/rundir3/uh
rundirall[10]=/scratch/ajohns14/rundir3/uh
rundirall[11]=/scratch/ajohns14/rundir3/uh
rundirall[12]=/scratch/ajohns14/rundir3/uh

 
#module load Python 
#module load basemap

module purge
module load netcdf4-python/1.1.8-intel-2015b-Python-2.7.10 pygrib numpy
  
enspathall[1]=/condo/map3/ajohns14/object/GSIplot_201705180000
enspathall[2]=/condo/map3/ajohns14/object/GSIplot_201705180000
enspathall[3]=/condo/map3/ajohns14/object/GSIplot_201705180000
enspathall[4]=/condo/map3/ajohns14/object/GSIplot_201705180000
enspathall[5]=/condo/map3/ajohns14/object/GSIplot_201705160000
enspathall[6]=/condo/map3/ajohns14/object/GSIplot_201705160000
enspathall[7]=/condo/map3/ajohns14/object/GSIplot_201705160000
enspathall[8]=/condo/map3/ajohns14/object/GSIplot_201705160000
enspathall[9]=/condo/map3/ajohns14/object/GSIplot_201705270000
enspathall[10]=/condo/map3/ajohns14/object/GSIplot_201705270000
enspathall[11]=/condo/map3/ajohns14/object/GSIplot_201705270000
enspathall[12]=/condo/map3/ajohns14/object/GSIplot_201705270000
enssize=10
inittimeall[1]=2017051800
inittimeall[2]=2017051800
inittimeall[3]=2017051800
inittimeall[4]=2017051800
inittimeall[5]=2017051600
inittimeall[6]=2017051600
inittimeall[7]=2017051600
inittimeall[8]=2017051600
inittimeall[9]=2017052700
inittimeall[10]=2017052700
inittimeall[11]=2017052700
inittimeall[12]=2017052700

sigmaall[1]=9
sigmaall[2]=9
sigmaall[3]=18
sigmaall[4]=18
sigmaall[5]=9
sigmaall[6]=9
sigmaall[7]=18
sigmaall[8]=18
sigmaall[9]=9
sigmaall[10]=9
sigmaall[11]=18
sigmaall[12]=18

thresholdall[1]=30
thresholdall[2]=40
thresholdall[3]=30
thresholdall[4]=40
thresholdall[5]=30
thresholdall[6]=40
thresholdall[7]=30
thresholdall[8]=40
thresholdall[9]=30
thresholdall[10]=40
thresholdall[11]=30
thresholdall[12]=40


whichexp=1
while [ ${whichexp} -le 12 ];do

sigma=${sigmaall[${whichexp}]}
threshold=${thresholdall[${whichexp}]}
inittime=${inittimeall[${whichexp}]}
enspath=${enspathall[${whichexp}]}
rundir=${rundirall[${whichexp}]}
mkdir ${rundir}
cd ${rundir}
cp ~/object/version1.0/* ./

outfilename=objects_dbz${threshold}_sigma${sigma}
   
#python driver.py ${enspath} ${enssize} ${inittime} ${sigma} ${threshold} ${outfilename} > python.output
#exit
 
#diststring=dist150
#diststring=dist100
diststring=dist200 #dist200
#efoldcentroid=150.0
#efoldcentroid=100.0
efoldcentroid=200.0 #200.0

#aspectstring=aspect20
#aspectstring=aspect10
aspectstring=aspect20 #aspect30
#efoldaspect=0.20
#efoldaspect=0.10
efoldaspect=0.20 #0.30

#areastring=area33
#areastring=area40
areastring=area40 #area25
#efoldarea=0.33
#efoldarea=0.40
efoldarea=0.40 #0.25

#memberstring=/
#memberstring=/median
memberstring= #/locmed
#determmethod=0
#determmethod=1
determmethod=EFMM #2
 
 
mkdir ${sigma}
mkdir ${sigma}/${threshold}
mkdir ${sigma}/${threshold}/${diststring}
mkdir ${sigma}/${threshold}/${diststring}/${aspectstring}
mkdir ${sigma}/${threshold}/${diststring}/${aspectstring}/${areastring}
mkdir ${sigma}/${threshold}/${diststring}/${aspectstring}/${areastring}/${memberstring}

infilepath=${rundir}/ #textfiles_${inittime}
minarea=375
minwind=0.0 #20
minvil=0.0 #60 
minuh=100.0 #100
minmaxprecip=0.0 #12.7 

python driver_plot.py ${enspath} ${enssize} ${inittime} ${sigma} ${threshold} ${infilepath} ${minarea} ${minwind} ${minvil} ${minuh} ${minmaxprecip} ${diststring}/${aspectstring}/${areastring}/${memberstring} ${determmethod} ${efoldcentroid} ${efoldarea} ${efoldaspect} > python_plot.output

whichexp=$((whichexp+1))
done

