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