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

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