Commit 11b1823528f5a537522184643786e64f9f9ec69a

Authored by Dany Dumont
1 parent 5652bb2b
Exists in master and in 1 other branch snow

Ajout de run_enp.sh comme exemple de script batch

Showing 1 changed file with 108 additions and 0 deletions   Show diff stats
scripts/shell/run_enp.sh 0 → 100755
... ... @@ -0,0 +1,108 @@
  1 +#!/bin/bash
  2 +
  3 +export EXPDIR=$(pwd)
  4 +echo $EXPDIR
  5 +
  6 +if [ $# -ne 1 ]
  7 +then
  8 + echo ""
  9 + echo "Usage: $0 <exp>"
  10 + echo ""
  11 + echo " <exp> should be one of the following:"
  12 + echo " 0910_E1 "
  13 + echo " 0910_E2 "
  14 + echo " 1011_E1 "
  15 + echo " 1011_E2 "
  16 + exit
  17 +fi
  18 +
  19 +exp=$1
  20 +
  21 +echo " Linking entry parameters and files for $exp"
  22 +rm -f *.dat
  23 +rm -f gotmrun.mal
  24 +rm -f obs.nml
  25 +rm -f airsea.mal
  26 +ln -sf $exp/enp/*.mal .
  27 +ln -sf $exp/*.nml .
  28 +ln -sf $exp/*.dat .
  29 +ln -sf enp_files/*.dat .
  30 +
  31 +if [ ! airsea.mal ] || [ ! gotmrun.mal ]
  32 +then
  33 + echo " ERROR : .mal files missing"
  34 + exit
  35 +else
  36 +
  37 +echo "-----------------------------------------------------"
  38 +echo " run_enp.sh"
  39 +echo "-----------------------------------------------------"
  40 +
  41 +
  42 +# Parameters for the forcings
  43 +
  44 +
  45 +count=1
  46 +
  47 +for file in ecmwf_meteo_*.dat
  48 +do
  49 +
  50 +count=`expr 000$count | tail -4c`
  51 +#count=`expr 000$count | tail -8c`
  52 +echo $count
  53 +
  54 +if [ -f airsea.nml ]
  55 +then
  56 + rm -f airsea.nml
  57 +fi
  58 +
  59 +cat airsea.mal | sed \
  60 + -e "s/meteofile/ecmwf_meteo_$count.dat/g" \
  61 + > airsea.nml
  62 +
  63 +if [ -f airsea.nml ]
  64 +then
  65 + echo " airsea.nml created"
  66 +fi
  67 +
  68 +if [ -f gotmrun.nml ]
  69 +then
  70 + rm -f gotmrun.nml
  71 +fi
  72 +
  73 +cat gotmrun.mal | sed \
  74 + -e "s/experiment_name/$count/g" \
  75 + > gotmrun.nml
  76 +
  77 +if [ -f gotmrun.nml ]
  78 +then
  79 + echo " gotmrun.nml created"
  80 +fi
  81 +
  82 +strt=`date +%H:%M:%S`
  83 +echo " runnning with "$file
  84 +echo " started at "$strt
  85 +
  86 +./gotm_prod_IFORT >& $count.out
  87 +
  88 +end=`date +%H:%M:%S`
  89 +echo " ended at "$end
  90 +
  91 +mv $count.nc $exp/enp
  92 +mv $count.out $exp/enp/
  93 +mv ${count}_fasham.par $exp/enp/
  94 +
  95 +count=`expr $count + 1`
  96 +
  97 +# Uncoment for debugging
  98 +if [ `expr $count` == 4 ]
  99 +then
  100 + echo " Exiting"
  101 + exit
  102 +fi
  103 +
  104 +done
  105 +
  106 +fi
  107 +
  108 +exit
... ...