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