#!/bin/bash
source ~/env_Multi_atlas.sh
comp=$1
local=`pwd -P`
if [ 1 == 0 ]; then
login=`whoami`
hostname=`hostname`
if [ ${hostname:0:5} = cicla ] ; then
DODSDIR=/thredds/ipsl
dthredds=thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds
HTML00=http://${dthredds}/$login
machine=ciclad
fi
if [ ${hostname:0:5} = spiri ] ; then
DODSDIR=/thredds/ipsl
dthredds=thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds
HTML00=http://${dthredds}/$login
machine=spirit
fi
if [ ${hostname:0:5} = camel ] ; then
DODSDIR=/thredds/ipsl
fi
if [ ${hostname:0:5} = irene ] ; then
DODSDIR=
fi
if [ ${hostname:0:5} = jean- ] ; then
DODSDIR=
fi
fi
COMP_D=$DODSDIR/$login/lmdz/MultiSimu/$comp
entetef=$COMP_D/entete.html
local=`pwd`
compf=$COMP_D/AXE7.html
HTML=$HTML00/lmdz/MultiSimu/$comp
DIRST=$DODSDIR/$login/lmdz/STATIONS
HTMLST=$HTML00/lmdz/STATIONS
DEF_FILE=$COMP_D/def.txt
if [ -f $entetef ] ; then cat $entetef > $compf ; else \rm -f $compf ; touch $compf ; fi
echo '
' >> $compf
cat <> $compf
Comparaison aux stations
Responsable : Fredho
eod
liste_sim=""
for s in `awk ' {print $1} ' $DEF_FILE | uniq` ; do liste_sim="$liste_sim $s" ; done
# Regroupement des fichiers images stations concernes
#----------------------------------------------------
mkdir -p $COMP_D/STATIONS ; cd $COMP_D/STATIONS
sortir=1
for s in $liste_sim ; do
if [ -d $DIRST/Figure_AMMA/$s -o -d $DIRST/Figure_SIRTA/$s -o -d $DIRST/Figure_SGP/$s ] ; then
ln -sf $DIRST/Figure_AMMA/$s/*png .
ln -sf $DIRST/Figure_SIRTA/$s/*png .
ln -sf $DIRST/Figure_SGP/$s/*png .
sortir=0
fi
done
if [ $sortir = 0 ] ; then
# html multi simulations par station
# ----------------------------------
virgu=""
for year in 2006 2007 2009 2011 2012; do
echo ' '$year' :' >> $compf
for station in wj ba ag na SIRTA SGP ; do
if [ "`ls *${station}*_${year}.png`" != "" ] ; then
lvar=( `ls *${station}*_${year}.png | cut -d_ -f1 | uniq` )
echo ${lvar[*]}
echo ${#lvar[@]}
lsim=( $liste_sim )
lpng="" ; virg="" ; for var in ${lvar[*]} ; do for s in $liste_sim ; do file=${var}_${station}_${s}_${year} ; echo FILE $file ; if [ -f "$file.png" ] ; then lpng="$lpng$virg$file" ; fi ; virg="," ; done ; done
~/LMDZ/MultiSimu/concat_html.sh . "OK" $lpng ${#lsim[@]} > $station$year.html
cat <> $compf
$virgu $station
eod
virgu=","
fi
done
echo '
' >> $compf
done
cd $local
for figu in AMMA SIRTA SGP; do
cat <> $compf
$figu simulation :
eod
virg=""
for s in $liste_sim ; do
if [ -d $DIRST/Figure_$figu/$s ] ; then
cat <> $compf
$virg $s
eod
virg=,
fi
done
cat <> $compf
eod
done
fi # sortir=0
if [ -d $COMP_D/STATSE ] ; then
cat <> $compf
Cycle saisonniers moyens aux bouees
eod
fi
cat <> $compf