source: BOL/Multi_atlas/atlas/atlas.sh @ 3697

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