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