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

Last change on this file since 3885 was 3885, checked in by musat, 3 years ago

Mise a jour des scripts par rapport a la version fabric
IM

  • Property svn:executable set to *
File size: 5.6 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=$REF
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=1
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
123   INDIR=$simdir/ATM/Analyse/SE
124   file=${INDIR}/`basename $simdir`_SE_$years_1M_histmth.nc
125   if [ ! -f ${file} ]; then
126      echo PB fichier $file inexistant
127      INDIR=$DODSDIR/$login/lmdz/SE/ORIG
128      file=$INDIR/`basename $simdir`_SE_$years_1M_histmth.nc
129   fi
130
131   #echo python $local/$pyatlas -v $vars -s `basename $simdir`_$years -t $ref -p $seas --root $INDIR
132   #python $local/$pyatlas -v $vars -s `basename $simdir`_$years -t $ref -p $seas --root $INDIR
133   echo python $local/$pyatlas -v $vars -s `basename $simdir`_$years -t $ref -p $seas
134   python $local/$pyatlas -v $vars -s `basename $simdir`_$years -t $ref -p $seas
135
136   #if [ ! -f "$html"  -o "`wc -l $html | awk ' { print $1 } '`" = "0" ] ; then
137   if [ ! -f "$htmlopt"  -o "`wc -l $htmlopt | 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:/modfs/ipslfs/dods/:/thredds/fileServer/IPSLFS/:g" tmp$$.$passage >| $htmlopt
149      \cp -f $htmlopt $OUT_D/
150      sed -i -e "s:thredds\/ipsl:thredds\/fileServer\/IPSLFS:g" $OUT_D/$htmlopt
151      #PathHtml=`echo $OUT_D/$htmlopt | sed -e 's:/modfs/ipslfs/dods/:http\://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/:'`
152      echo NOUVEL ATLAS DISPONIBLE SUR $PathHtml | tee >>  atlas.sh.log
153      echo NOUVEL ATLAS DISPONIBLE SUR $PathHtml
154      #echo $keys_strgv >> $OUT_D/atlas_OK
155      #echo ${sim}+${seas}+${proj}+$vars >> $OUT_D/atlas_OK
156   fi
157   (( ipass = $ipass + 1 ))
158
159done
160
161\rm -f $OUT_D/$keys_strg.ENCOURS
Note: See TracBrowser for help on using the repository browser.