| 1 | #!/bin/bash |
|---|
| 2 | |
|---|
| 3 | if [ `pwd | grep -o HighTune | wc -l` -gt 1 ] |
|---|
| 4 | then |
|---|
| 5 | echo "Careful: the HighTune string appears more than once in your current directory:" |
|---|
| 6 | pwd |
|---|
| 7 | echo "This is going to be a problem! Make sure it appears only once!" |
|---|
| 8 | # some sed commands won't work otherwise; this should be improved. |
|---|
| 9 | exit |
|---|
| 10 | fi |
|---|
| 11 | |
|---|
| 12 | model=LMDZ |
|---|
| 13 | cas=ARMCU/REF |
|---|
| 14 | param=param_cldb |
|---|
| 15 | |
|---|
| 16 | if [ $# -eq 1 ] ; then |
|---|
| 17 | model=ECRAD |
|---|
| 18 | cas=ARMCU/008 |
|---|
| 19 | param=param |
|---|
| 20 | fi |
|---|
| 21 | |
|---|
| 22 | WDIR=BENCH$csv$model |
|---|
| 23 | ./setup.sh $model $WDIR |
|---|
| 24 | cd WORK/$WDIR |
|---|
| 25 | |
|---|
| 26 | ./param2R.sh 30 3 $param |
|---|
| 27 | if [ $? -eq 0 ]; then |
|---|
| 28 | sed -i "s/WAVEN=.*/WAVEN=1/g" expe_setup.R # setup experiment |
|---|
| 29 | sed -i "s/targetvar=.*/targetvar=c('theta500', 'qv500', 'zhneb', 'nebmax')/g" expe_setup.R |
|---|
| 30 | sed -i "s/tau=.*/tau=1/g" expe_setup.R |
|---|
| 31 | sed -i "s/Cutoff=.*/Cutoff=3/g" expe_setup.R |
|---|
| 32 | # sed -i command is a bit different on mac. We should have the following: |
|---|
| 33 | # sed -i "" "s/targetvar=.*/targetvar=c('theta500', 'qv500', 'zhneb', 'nebmax')/g" expe_setup.R |
|---|
| 34 | ./serie_$model.sh $cas 1 # run model with parameters |
|---|
| 35 | if [ $? -eq 0 ]; then |
|---|
| 36 | Rscript htune_ncdf2Rdata.R # read models outputs and compute metrics |
|---|
| 37 | Rscript htune_EmulatingMultiMetric.R # emulate and history match |
|---|
| 38 | |
|---|
| 39 | pdfjam Rplots.pdf 2 |
|---|
| 40 | pdf2ps Rplots-2-pdfjam.pdf |
|---|
| 41 | ps2epsi Rplots-2-pdfjam.ps |
|---|
| 42 | epstopdf Rplots-2-pdfjam.epsi |
|---|
| 43 | pdfjam Rplots-2-pdfjam.pdf InputSpace_wave1.pdf --nup 2x1 --landscape --outfile result_wave1.pdf |
|---|
| 44 | evince result_wave1.pdf & |
|---|
| 45 | |
|---|
| 46 | ./param2Rwave.sh 2 Wave2.RData # generate new wave parameters |
|---|
| 47 | sed -i "/WAVEN=.*/WAVEN=2/g" expe_setup.R # setup experiment |
|---|
| 48 | sed -i "/targetvar=.*/targetvar=c('theta500', 'qv500', 'zhneb', 'nebmax')/g" expe_setup.R |
|---|
| 49 | sed -i "/tau=.*/tau=0/g" expe_setup.R |
|---|
| 50 | sed -i "s/Cutoff=.*/Cutoff=3/g" expe_setup.R |
|---|
| 51 | ./serie_$model.sh $cas 2 # run model with parameters |
|---|
| 52 | if [ $? -eq 0 ]; then |
|---|
| 53 | Rscript htune_ncdf2Rdata.R |
|---|
| 54 | Rscript htune_EmulatingMultiMetric.R |
|---|
| 55 | |
|---|
| 56 | pdfjam Rplots.pdf 2 |
|---|
| 57 | pdf2ps Rplots-2-pdfjam.pdf |
|---|
| 58 | ps2epsi Rplots-2-pdfjam.ps |
|---|
| 59 | epstopdf Rplots-2-pdfjam.epsi |
|---|
| 60 | pdfjam Rplots-2-pdfjam.pdf InputSpace_wave2.pdf --nup 2x1 --landscape --outfile result_wave2.pdf |
|---|
| 61 | evince result_wave2.pdf & |
|---|
| 62 | |
|---|
| 63 | echo '##########################################################' |
|---|
| 64 | echo ' Next version will start heating water at tea time ' |
|---|
| 65 | echo '##########################################################' |
|---|
| 66 | |
|---|
| 67 | fi |
|---|
| 68 | fi |
|---|
| 69 | fi |
|---|