source: BOL/Multi_atlas/Utils/atlas0.sh @ 3684

Last change on this file since 3684 was 3684, checked in by idelkadi, 4 years ago

Repository under svn of a first version of Multiatlas diagnostics for LMDZ. This version is adapted to be able to run a LMDZ multiatlas on an individual account on the ciclad machine of the IPSL. In this version, the parts to be modified are identified so as to subsequently adapt it to other machines.
This version is still under development.

  • Property svn:executable set to *
File size: 4.3 KB
Line 
1local=`pwd -P`
2cd $local
3
4date
5
6vars=""
7vars="sst"
8#runstxt=$local/../runs.txt
9
10if [ $# = 1 ] ; then
11   opts="`echo $1 | sed -e 's/,/ /g'`"
12   for opt in $opts ; do
13       echo $opt
14       key=`echo $opt | cut -d= -f1`
15       val=`echo $opt | cut -d= -f2`
16       echo $key $val
17       if [ "$key" = "RUN" ] ; then sim=$val ; fi
18       if [ "$key" = "REF" ] ; then ref=$val ; fi
19       if [ "$key" = "SEASON" ] ; then seas=$val ; fi
20       if [ "$key" = "PROJ" ] ; then proj=$val ; fi
21       if [ "$key" = "OUTDIR" ] ; then OUT_D=$val ; fi
22       if [ "$key" = "RUNSTXT" ] ; then runstxt=$val ; fi
23       if [ "$key" = "VARS" ] ; then vars="`echo $val | sed -e 's/+/,/g'`" ; fi
24   done
25elif [ $# = 0 ] ; then
26   sim=$RUN
27   ref=OBS
28   seas=$SEASON
29   proj=$PROJ
30   OUT_D=$OUTDIR
31   runstxt=$RUNSTXT
32   vars=`echo $VARS | sed -e 's/+/,/g'`
33else
34  echo USE
35  echo Job mode :
36  echo $submit -v RUN=NPv5.3_1982_1989,SEASON=YEAR,PROJ=GLOB,OUTDIR=$MULTIDIR/V5/ATLAS,VARS=pr+tas atlas.sh
37  echo interactif :
38  echo ./atlas.sh RUN=NPv5.3_1982_1989,SEASON=YEAR,PROJ=GLOB,OUTDIR=$MULTIDIR/V5/ATLAS,VARS=pr+tas
39  exit
40fi
41
42if [ "$vars" = "" ] ; then
43   vars=pr,tas,hurs,hfls,hfss,albt,albtcs,albs,rldscs,rlds,rlus,rsdscs,rsds,rsuscs,rsus,rsutcs,rsut,rlut,rlutcs,psl,prw,sst,pme,tasmax,tasmin
44fi
45
46#,ua850,va850,ta850,ua500,va500,ta500,ua200,va200,ta200
47echo sim $sim
48srun=`echo $sim | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'`
49echo srun $srun
50simdir=`grep -w "^$srun" $runstxt | awk ' { print $2 } '`
51run=`basename $simdir `
52years=`echo $sim | sed -e 's/'$srun'//' | sed -e 's/_//'`
53sim=${run}_${years}
54echo $run $years $sim $ref
55echo ENTREES : $run, $years, $seas, $vars, $ref
56echo simdir $simdir
57
58echo run $run 
59echo sim $sim
60echo simdir $simdir
61
62keys_strgv=$sim$seas$proj$vars$ref
63keys_strg=$sim$seas$proj$ref
64
65mkdir -p $OUT_D
66if [ -f $OUT_D/$keys_strg.ENCOURS ] ; then 
67   echo $OUT_D/$keys_strg.ENCOURS
68   exit # Si le même atlas est deja en cours de realisation on sort
69else
70   touch $OUT_D/$keys_strg.ENCOURS
71fi
72
73if [ "$OUT_D" = "" ] ; then
74   $OUT_D=$STORAGE/NPV5LRL79/$run/ATLAS/SE_$years/ATM
75fi
76
77cd $ATLAS_DIR
78echo sim $sim seas $seas > atlas.sh.log
79
80###########################################################################
81# Boucle pour construire l'atlas en plusieurs passages
82echo IL FAUT FAIRE L ATLAS EN PLUSIEURS PASSAGE SINON CA PLANTE ...
83###########################################################################
84
85case "$proj" in
86   "SH"|"NH") pyatlas="atlas_SH.py --projection $proj" ;;
87   "GLOB") Var3D=,ua,va,ta,hus,hur ; pyatlas=atlas_none.py ;;
88esac
89
90
91npass=5
92ipass=1
93
94while [ $ipass -le $npass ] ; do
95
96   echo Nettoyage des fichiers corrompus du cache
97   ~/LMDZ/atlas/clean_cache.sh
98   echo passage $ipass >> atlas.sh.log
99   html=index_example_"$seas"_"$sim".html
100   htmlopt=index_${proj}_"$seas"_"$sim".html
101   rm -f $html
102   ###echo python /home/fabric/LMDZ/atlas/$pyatlas --force -v $vars -s `basename $simdir`_$years -t $ref -p $seas -i $simdir/ATM/Analyse/SE
103   echo python $local/$pyatlas -v $vars -s `basename $simdir`_$years -t $ref -p $seas --root $simdir/ATM/Analyse/SE
104   ###python /home/fabric/LMDZ/atlas/$pyatlas --force -v $vars -s `basename $simdir`_$years -t $ref -p $seas -i $simdir/ATM/Analyse/SE
105   python $local/$pyatlas -v $vars -s `basename $simdir`_$years -t $ref -p $seas --root $simdir/ATM/Analyse/SE
106   #python /home/fabric/LMDZ/atlas/$pyatlas -v $vars -s `basename $simdir`_$years -t $ref -p $seas -i $simdir/ATM/Analyse/SE --root XXXX
107
108   if [ ! -f "$html"  -o "`wc -l $html | awk ' { print $1 } '`" = "0" ] ; then
109      echo ECHEC ATLAS : $html inexistant ou vide | tee >>  atlas.sh.log
110      echo ECHEC ATLAS : $html inexistant ou vide
111   else
112      echo cp -f $html tmp$$.$passage
113      cp -f $html tmp$$.$passage
114      pwd
115      echo tmp$$.$passage
116      echo LS  LS
117      ls -lrt | tail
118# A ADAPTER en fonction de la machine
119      sed -e "s:/prodigfs/ipslfs/dods/:/thredds/fileServer/IPSLFS/:g" tmp$$.$passage >| $htmlopt
120      \cp -f $htmlopt $OUT_D/
121      PathHtml=`echo $OUT_D/$htmlopt | sed -e 's:/prodigfs/ipslfs/dods/:http\://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/:'`
122      echo NOUVEL ATLAS DISPONIBLE SUR $PathHtml | tee >>  atlas.sh.log
123      echo NOUVEL ATLAS DISPONIBLE SUR $PathHtml
124      echo $keys_strgv >> $OUT_D/atlas_OK
125      echo ${sim}+${seas}+${proj}+$vars >> $OUT_D/atlas_OK
126   fi
127   (( ipass = $ipass + 1 ))
128
129done
130
131\rm -f $OUT_D/$keys_strg.ENCOURS
Note: See TracBrowser for help on using the repository browser.