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