[4308] | 1 | ########################################################################### |
---|
[3696] | 2 | # Environnement |
---|
[4308] | 3 | local=`pwd -P` |
---|
| 4 | |
---|
[4340] | 5 | source ~/env_Multi_atlas.sh |
---|
[4317] | 6 | |
---|
[4308] | 7 | module list |
---|
[4330] | 8 | python=`which python` |
---|
| 9 | echo PYTHON IS $python |
---|
| 10 | |
---|
[3696] | 11 | ulimit -s unlimited |
---|
[4308] | 12 | ATLAS_DIR=${DODSDIR}/${login}/lmdz/atlas/Atlas$$ ; mkdir -p $ATLAS_DIR |
---|
| 13 | STORAGE=${DODSDIR}/${login}/lmdz/STORE |
---|
| 14 | dirpng=${DODSDIR}/${login}/lmdz/VLR |
---|
| 15 | |
---|
[4330] | 16 | if [ 1 == 0 ]; then |
---|
[4308] | 17 | export PYTHONPATH=$PYTHONPATH:/home/fabric/users/denvil/climaf |
---|
[3696] | 18 | export PATH=$PATH:/home/fabric/users/denvil/climaf/bin |
---|
[4330] | 19 | fi |
---|
[3684] | 20 | |
---|
[4330] | 21 | #myCC=$DODSDIR/$login/IMclimafCache |
---|
| 22 | #if [ 1 == 0 ]; then |
---|
[4345] | 23 | #myCC=/scratchu/${login}/climafCache041122run |
---|
| 24 | myCC=/scratchu/${login}/climafCache$$ |
---|
| 25 | \rm -rf ${myCC} |
---|
[4330] | 26 | mkdir -p ${myCC} |
---|
| 27 | export CLIMAF_CACHE=${myCC} |
---|
| 28 | echo CLIMAF_CACHE ${CLIMAF_CACHE} |
---|
| 29 | mkdir -p ${CLIMAF_CACHE}/remote_data |
---|
| 30 | export CLIMAF_REMOTE_CACHE=${CLIMAF_CACHE}/remote_data |
---|
| 31 | #fi |
---|
| 32 | #exit |
---|
| 33 | #\rm -rf $DODSDIR/$login/climafCache$$ |
---|
| 34 | #mkdir -p $DODSDIR/$login/climafCache$$ |
---|
| 35 | #export CLIMAF_CACHE=$DODSDIR/$login/climafCache$$ |
---|
| 36 | #echo CLIMAF_CACHE $DODSDIR/$login/climafCache$$ |
---|
[4308] | 37 | ########################################################################### |
---|
[3684] | 38 | vars="" |
---|
| 39 | vars="sst" |
---|
[4308] | 40 | #runstxt=/home/fabric/LMDZ/multi/runs.txt |
---|
[3684] | 41 | |
---|
| 42 | if [ $# = 1 ] ; then |
---|
| 43 | opts="`echo $1 | sed -e 's/,/ /g'`" |
---|
| 44 | for opt in $opts ; do |
---|
| 45 | echo $opt |
---|
| 46 | key=`echo $opt | cut -d= -f1` |
---|
| 47 | val=`echo $opt | cut -d= -f2` |
---|
| 48 | echo $key $val |
---|
| 49 | if [ "$key" = "RUN" ] ; then sim=$val ; fi |
---|
| 50 | if [ "$key" = "REF" ] ; then ref=$val ; fi |
---|
| 51 | if [ "$key" = "SEASON" ] ; then seas=$val ; fi |
---|
| 52 | if [ "$key" = "PROJ" ] ; then proj=$val ; fi |
---|
| 53 | if [ "$key" = "OUTDIR" ] ; then OUT_D=$val ; fi |
---|
| 54 | if [ "$key" = "RUNSTXT" ] ; then runstxt=$val ; fi |
---|
[4308] | 55 | if [ "$key" = "VARS" ] ; then vars="`echo $val | sed -e 's/+/ /g'`" ; fi |
---|
| 56 | if [ "$key" = "lonmin" ] ; then lonmin=$val ; fi |
---|
| 57 | if [ "$key" = "lonmax" ] ; then lonmax=$val ; fi |
---|
| 58 | if [ "$key" = "latmin" ] ; then latmin=$val ; fi |
---|
| 59 | if [ "$key" = "latmax" ] ; then latmax=$val ; fi |
---|
| 60 | if [ "$key" = "pmin" ] ; then pmin=$val ; fi |
---|
[3684] | 61 | done |
---|
| 62 | elif [ $# = 0 ] ; then |
---|
| 63 | sim=$RUN |
---|
[3885] | 64 | ref=$REF |
---|
[3684] | 65 | seas=$SEASON |
---|
| 66 | proj=$PROJ |
---|
| 67 | OUT_D=$OUTDIR |
---|
| 68 | runstxt=$RUNSTXT |
---|
[4308] | 69 | vars=`echo $VARS | sed -e 's/+/ /g'` |
---|
| 70 | lonmin=$lonmin |
---|
| 71 | lonmax=$lonmax |
---|
| 72 | latmin=$latmin |
---|
| 73 | latmax=$latmax |
---|
| 74 | pmin=$pmin |
---|
| 75 | echo lonmin=$lonmin lonmax=$lonmax |
---|
| 76 | echo latmin=$latmin latmax=$latmax |
---|
| 77 | echo pmin=$pmin |
---|
[3684] | 78 | else |
---|
| 79 | echo USE |
---|
| 80 | echo Job mode : |
---|
[4308] | 81 | echo qsub -v RUN=NPv5.3_1982_1989,SEASON=YEAR,PROJ=GLOB,OUTDIR=$MULTIDIR/V5/ATLAS,VARS=pr+tas atlas.sh |
---|
[3684] | 82 | echo interactif : |
---|
| 83 | echo ./atlas.sh RUN=NPv5.3_1982_1989,SEASON=YEAR,PROJ=GLOB,OUTDIR=$MULTIDIR/V5/ATLAS,VARS=pr+tas |
---|
| 84 | exit |
---|
| 85 | fi |
---|
| 86 | |
---|
| 87 | if [ "$vars" = "" ] ; then |
---|
[4308] | 88 | 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" |
---|
[3684] | 89 | fi |
---|
| 90 | |
---|
[4308] | 91 | if [ "$sim" != "OBS" ]; then |
---|
[3684] | 92 | echo sim $sim |
---|
| 93 | srun=`echo $sim | sed -e 's/_[0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9]//'` |
---|
| 94 | echo srun $srun |
---|
[4308] | 95 | simdir=`grep -w "^$srun " $runstxt | awk ' { print $2 } '` |
---|
[3684] | 96 | run=`basename $simdir ` |
---|
| 97 | years=`echo $sim | sed -e 's/'$srun'//' | sed -e 's/_//'` |
---|
| 98 | sim=${run}_${years} |
---|
[4308] | 99 | |
---|
[3684] | 100 | echo $run $years $sim $ref |
---|
| 101 | echo ENTREES : $run, $years, $seas, $vars, $ref |
---|
| 102 | echo simdir $simdir |
---|
| 103 | |
---|
| 104 | echo run $run |
---|
| 105 | echo sim $sim |
---|
| 106 | echo simdir $simdir |
---|
[4308] | 107 | fi |
---|
[3684] | 108 | |
---|
| 109 | keys_strgv=$sim$seas$proj$vars$ref |
---|
| 110 | keys_strg=$sim$seas$proj$ref |
---|
| 111 | |
---|
| 112 | mkdir -p $OUT_D |
---|
| 113 | if [ -f $OUT_D/$keys_strg.ENCOURS ] ; then |
---|
| 114 | echo $OUT_D/$keys_strg.ENCOURS |
---|
| 115 | exit # Si le même atlas est deja en cours de realisation on sort |
---|
| 116 | else |
---|
| 117 | touch $OUT_D/$keys_strg.ENCOURS |
---|
| 118 | fi |
---|
| 119 | |
---|
| 120 | if [ "$OUT_D" = "" ] ; then |
---|
| 121 | $OUT_D=$STORAGE/NPV5LRL79/$run/ATLAS/SE_$years/ATM |
---|
| 122 | fi |
---|
| 123 | |
---|
| 124 | cd $ATLAS_DIR |
---|
| 125 | echo sim $sim seas $seas > atlas.sh.log |
---|
| 126 | |
---|
| 127 | case "$proj" in |
---|
| 128 | "SH"|"NH") pyatlas="atlas_SH.py --projection $proj" ;; |
---|
| 129 | "GLOB") Var3D=,ua,va,ta,hus,hur ; pyatlas=atlas_none.py ;; |
---|
[4308] | 130 | *) Var3D=,ua,va,ta,hus,hur ; pyatlas=atlas_none.py ;; |
---|
[3684] | 131 | esac |
---|
| 132 | |
---|
| 133 | html=index_example_"$seas"_"$sim".html |
---|
[3885] | 134 | htmlopt=index_"${proj}"_"$seas"_"$sim".html |
---|
[4308] | 135 | echo rm -f $htmlopt |
---|
| 136 | # |
---|
| 137 | for var in $vars; do |
---|
| 138 | datevar=`date` |
---|
| 139 | echo Creation repertoires *MAP* et check variables 3D |
---|
| 140 | mkdir -p ${dirpng}/${seas}/${sim}/MAP |
---|
| 141 | mkdir -p ${dirpng}/${seas}/${sim}/MAP/${proj} |
---|
| 142 | # |
---|
| 143 | mkdir -p ${dirpng}/${seas}/${ref}/MAP |
---|
| 144 | mkdir -p ${dirpng}/${seas}/${ref}/MAP/${proj} |
---|
| 145 | # |
---|
| 146 | mkdir -p ${dirpng}/${seas}/${sim}/DMAP_${ref} |
---|
| 147 | mkdir -p ${dirpng}/${seas}/${sim}/DMAP_${ref}/${proj} |
---|
[3684] | 148 | |
---|
[4330] | 149 | refok=${dirpng}/${seas}/${ref}/MAP/${proj}/${var}.pdf |
---|
[4308] | 150 | mapok=${dirpng}/${seas}/${sim}/MAP/${proj}/${var}.pdf |
---|
| 151 | dmapok=${dirpng}/${seas}/${sim}/DMAP_${ref}/${proj}/${var}.pdf |
---|
| 152 | # |
---|
| 153 | datevar=`date` |
---|
| 154 | # |
---|
| 155 | # for var3D check if pres exist |
---|
| 156 | # echo ~/LMDZ/check/make_check_var3D_SE.sh $dirpng $seas $sim $ref $var |
---|
| 157 | # ~/LMDZ/check/make_check_var3D_SE.sh $dirpng $seas $sim $ref $var > out_check_var3D_SE.log |
---|
[3884] | 158 | |
---|
[4330] | 159 | if [ ! -f ${refok} ] || [ ! -f ${mapok} ] || [ ! -f ${dmapok} ]; then |
---|
| 160 | |
---|
| 161 | echo Fabrication des cartes $var pour $ref $sim $sim-$ref |
---|
[4345] | 162 | ### |
---|
| 163 | echo 4 call to climaf instead of 1 to get rid of cache issue |
---|
| 164 | ### |
---|
[4308] | 165 | if [ "$var" == "ua" ] || [ "$var" == "va" ] || [ "$var" == "ta" ] || [ "$var" == "hur" ] || [ "$var" == "hus" ]; then |
---|
[4345] | 166 | ### |
---|
[4330] | 167 | echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} |
---|
| 168 | $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} |
---|
[4345] | 169 | ### |
---|
| 170 | echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} |
---|
| 171 | $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} |
---|
| 172 | # |
---|
| 173 | echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} |
---|
| 174 | $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} |
---|
| 175 | ### |
---|
| 176 | echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} |
---|
| 177 | $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} |
---|
| 178 | |
---|
[4308] | 179 | else |
---|
[4345] | 180 | echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin} |
---|
| 181 | $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin} |
---|
| 182 | # |
---|
| 183 | echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin} |
---|
| 184 | $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin} |
---|
| 185 | # |
---|
| 186 | echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin} |
---|
| 187 | $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin} |
---|
| 188 | # |
---|
| 189 | echo $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin} |
---|
| 190 | $python ${local}/$pyatlas -v $var -s $sim -t $ref -p $seas -r $proj --dirpng ${dirpng} --lonmin ${lonmin} --lonmax ${lonmax} --latmin ${latmin} --latmax ${latmax} --pmin ${pmin} |
---|
| 191 | # |
---|
[4308] | 192 | fi |
---|
| 193 | # |
---|
[4330] | 194 | else |
---|
| 195 | echo Les images $refok |
---|
| 196 | echo $mapok et |
---|
| 197 | echo $dmapok |
---|
| 198 | echo existent deja |
---|
| 199 | fi |
---|
| 200 | # |
---|
[4308] | 201 | echo Creation graphes png |
---|
[4317] | 202 | ${local}/make_pdf2png.sh $dirpng $seas $proj $sim $ref $var > out_pdf2png.log |
---|
[4308] | 203 | # |
---|
| 204 | done |
---|
[3884] | 205 | |
---|
[3885] | 206 | if [ ! -f "$htmlopt" -o "`wc -l $htmlopt | awk ' { print $1 } '`" = "0" ] ; then |
---|
[3915] | 207 | echo ECHEC ATLAS : $htmlopt inexistant ou vide | tee >> atlas.sh.log |
---|
| 208 | echo ECHEC ATLAS : $htmlopt inexistant ou vide |
---|
[3684] | 209 | else |
---|
| 210 | pwd |
---|
| 211 | \cp -f $htmlopt $OUT_D/ |
---|
[4308] | 212 | sed -i -e "s:thredds\/IPSLFS:thredds\/fileServer\/ipsl_thredds:g" $OUT_D/$htmlopt |
---|
| 213 | |
---|
[3684] | 214 | echo NOUVEL ATLAS DISPONIBLE SUR $PathHtml | tee >> atlas.sh.log |
---|
| 215 | echo NOUVEL ATLAS DISPONIBLE SUR $PathHtml |
---|
| 216 | fi |
---|
| 217 | |
---|
[4308] | 218 | \rm -f $OUT_D/$keys_strg.ENCOURS |
---|
[3684] | 219 | |
---|
[4330] | 220 | #IM041122 \rm -rf $DODSDIR/$login/climafCache$$ |
---|
[4345] | 221 | \rm -rf ${myCC} |
---|