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