source: BOL/Multi_atlas/atlas/atlas_inter.sh

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