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

Last change on this file since 3725 was 3701, 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.
Corrections

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