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