1 | #!/bin/bash |
---|
2 | |
---|
3 | #A REFAIRE |
---|
4 | |
---|
5 | local=`pwd -P` |
---|
6 | login=`whoami` |
---|
7 | hostname=`hostname` |
---|
8 | if [ ${hostname:0:5} = cicla ] ; then |
---|
9 | DODSDIR=/thredds/ipsl |
---|
10 | HTML00=http://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/$login |
---|
11 | machine=ciclad |
---|
12 | fi |
---|
13 | if [ ${hostname:0:5} = camel ] ; then |
---|
14 | DODSDIR=/thredds/ipsl |
---|
15 | fi |
---|
16 | if [ ${hostname:0:5} = irene ] ; then |
---|
17 | DODSDIR= |
---|
18 | fi |
---|
19 | if [ ${hostname:0:5} = jean- ] ; then |
---|
20 | DODSDIR= |
---|
21 | fi |
---|
22 | |
---|
23 | runstxt=$local/runs.txt |
---|
24 | PREF_F=$DODSDIR |
---|
25 | PREF_W=http\://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS |
---|
26 | MULTIDIR=$PREF_F/$login/lmdz/MultiSimu |
---|
27 | #BASE_D=/home/fabric/users/dcugnet |
---|
28 | BASE_D=$local/LMA |
---|
29 | OUT_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 |
---|
33 | if [ $# -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 |
---|
37 | fi |
---|
38 | comp=$1 |
---|
39 | |
---|
40 | #=== CHECK WETHER GIVEN ARGUMENT IS VALID |
---|
41 | COMP_D=$MULTIDIR/$comp |
---|
42 | if [ ! -f $COMP_D/def.txt ]; then |
---|
43 | echo "Nonexisting comparison file $COMP_D/def.txt"; exit |
---|
44 | fi |
---|
45 | |
---|
46 | #=== SOME MORE PATHS/FILES |
---|
47 | AXE_D=$COMP_D/AXE2; if [ ! -d $AXE_D/AXE2 ]; then mkdir -p $AXE_D/AXE2; fi |
---|
48 | FIG_D=$AXE_D/METRICS #--- FIGURES STORAGE PATH |
---|
49 | headf=$COMP_D/entete.html #--- HTML PAGES HEADER |
---|
50 | compf=$COMP_D/lma2.html #--- GENERATED HTML PAGE |
---|
51 | if [ ! -d $FIG_D ]; then mkdir -p $FIG_D; fi |
---|
52 | AXE_W=$(echo $AXE_D | sed -e "s%$PREF_F%$PREF_W%") |
---|
53 | FIG_W=$(echo $FIG_D | sed -e "s%$PREF_F%$PREF_W%") |
---|
54 | webf=$AXE_W/lma.html |
---|
55 | PLOT_D=$BASE_D/LMA_LMDZ/$comp |
---|
56 | |
---|
57 | #=== GENERATE THE pdf FILES ; CONVERT THEM INTO png FILES |
---|
58 | cd $PLOT_D |
---|
59 | ./plot_lma.bash |
---|
60 | for f in `ls *.pdf`; do convert -density 600 $f -resample 600 $FIG_D/${f%.*}.png; done |
---|
61 | cd - 1> /dev/null |
---|
62 | |
---|
63 | #=== BUILD THE HTML PAGE |
---|
64 | boxes=($(ls $FIG_D/boxes_*.png)) |
---|
65 | modes=($(ls $FIG_D/modes_*.png)) |
---|
66 | cat $headf > $compf |
---|
67 | echo "</style> </head> <body>" >> $compf |
---|
68 | echo "<h2> Local Modes Analysis (LMA) </h2>" >> $compf |
---|
69 | echo "<hr/> <!--- this draws a line --->" >> $compf |
---|
70 | echo "<div width=100%>" >> $compf |
---|
71 | echo "<table>" >> $compf |
---|
72 | for 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 |
---|
76 | done |
---|
77 | echo "</table>" >> $compf |
---|
78 | |
---|
79 | echo $compf | sed -e "s%$PREF_F%$PREF_W%" |
---|