source: BOL/Multi_atlas/html_lma.sh @ 4304

Last change on this file since 4304 was 3881, checked in by musat, 4 years ago

Changement des PATHS sur ciclad

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#!/bin/bash
2
3#A REFAIRE
4
5local=`pwd -P`
6login=`whoami`
7hostname=`hostname`
8if [ ${hostname:0:5} = cicla ] ; then
9DODSDIR=/thredds/ipsl
10HTML00=http://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/$login
11machine=ciclad
12fi
13if [ ${hostname:0:5} = camel ] ; then
14DODSDIR=/thredds/ipsl
15fi
16if [ ${hostname:0:5} = irene ] ; then
17DODSDIR=
18fi
19if [ ${hostname:0:5} = jean- ] ; then
20DODSDIR=
21fi
22
23runstxt=$local/runs.txt
24PREF_F=$DODSDIR
25PREF_W=http\://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS
26MULTIDIR=$PREF_F/$login/lmdz/MultiSimu
27#BASE_D=/home/fabric/users/dcugnet
28BASE_D=$local/LMA
29OUT_D=/prodigfs/$login/LMDZ6/AXE2/LMA_LMDZ
30#TS_DA=$PREF_F/fabric/lmdz/TS_DA
31
32#=== CHECK WETHER REQUIRED ARGUMENT HAS IS PRESENT
33if [ $# -ne 1 ]; then
34  echo "This script needs a single argument: the comparison name"
35  echo "   (the name of the folder containing the def.txt file)"
36  exit
37fi
38comp=$1
39
40#=== CHECK WETHER GIVEN ARGUMENT IS VALID
41COMP_D=$MULTIDIR/$comp
42if [ ! -f $COMP_D/def.txt ]; then
43  echo "Nonexisting comparison file $COMP_D/def.txt"; exit
44fi
45
46#=== SOME MORE PATHS/FILES
47AXE_D=$COMP_D/AXE2; if [ ! -d $AXE_D/AXE2 ]; then mkdir -p $AXE_D/AXE2; fi
48FIG_D=$AXE_D/METRICS         #--- FIGURES STORAGE PATH
49headf=$COMP_D/entete.html    #--- HTML PAGES HEADER
50compf=$COMP_D/lma2.html       #--- GENERATED HTML PAGE
51if [ ! -d $FIG_D ]; then mkdir -p $FIG_D; fi
52AXE_W=$(echo $AXE_D | sed -e "s%$PREF_F%$PREF_W%")
53FIG_W=$(echo $FIG_D | sed -e "s%$PREF_F%$PREF_W%")
54webf=$AXE_W/lma.html
55PLOT_D=$BASE_D/LMA_LMDZ/$comp
56
57#=== GENERATE THE pdf FILES ; CONVERT THEM INTO png FILES
58cd $PLOT_D
59./plot_lma.bash
60for f in `ls *.pdf`; do convert -density 600 $f -resample 600 $FIG_D/${f%.*}.png; done
61cd - 1> /dev/null
62
63#=== BUILD THE HTML PAGE
64boxes=($(ls $FIG_D/boxes_*.png))
65modes=($(ls $FIG_D/modes_*.png))
66cat $headf                                                             > $compf
67echo "</style> </head> <body>"                                        >> $compf
68echo "<h2> Local Modes Analysis (LMA) </h2>"                          >> $compf
69echo "<hr/> <!--- this draws a line --->"                             >> $compf
70echo "<div width=100%>"                                               >> $compf
71echo "<table>"                                                        >> $compf
72for i in $(eval echo {1..${#boxes[@]}}); do
73  box=${boxes[$((i-1))]}; mod=${modes[$((i-1))]}
74  echo "<tr><td><img src="$FIG_W/${box##*/}" width="100%" border=0></td></tr>" >> $compf
75  echo "<tr><td><img src="$FIG_W/${mod##*/}" width="100%" border=0></td></tr>" >> $compf
76done
77echo "</table>"                                                       >> $compf
78
79echo $compf | sed -e "s%$PREF_F%$PREF_W%"
Note: See TracBrowser for help on using the repository browser.