source: BOL/Multi_atlas/concat_html.sh @ 3945

Last change on this file since 3945 was 3737, checked in by idelkadi, 4 years ago

Repository under svn of a first version of Multiatlas diagnostics for LMDZ. This version is adapted to be able to run a LMDZ multiatlas on an individual account on the ciclad machine of the IPSL. In this version, the parts to be modified are identified so as to subsequently adapt it to other machines.
Modifications following changes and simplification of access from CICLAD / ClimServ?? to the different "thredds"

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#!/bin/bash
2
3##########################################################################
4# Concatenne une liste de fichiers fichA1,fichA2:fichB1,fichB2:fichC1,fichC2
5# sous forme d'un LaTeX tabular et d'un html
6##########################################################################
7
8PNG_D=$1
9title=$2
10vvvvv=$3
11
12
13if [ "$vvvvv" = "." ] ; then
14   vvvvv=`ls $PNG_D/*.png | sed "s/.*\///" | \
15  sed "s/\.png//" | awk '{printf "%s,",$0}' | sed 's/\(.*\),/\1/'`
16fi
17
18
19
20if [ "$#" = "4" ] ; then
21   ligne=$4
22   vvvv=`ic=0 ; sep="" ; list="" ; for i in \`echo $vvvvv | sed -e 's/[,\:]/ /g'\` ; do list="$list$sep$i" ; ((ic=$ic+1)) ; if [ $ic = $ligne ] ; then sep=":" ; ic=0 ; else sep="," ; fi ; done ; echo $list`
23fi
24
25
26
27cat <<eod
28<table>
29
30<h1> $2 <A HREF=`echo $PNG_D/index.pdf | sed -e 's:/modfs/ipslfs/dods/:http\://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/:'`> PDF </A></h1>
31eod
32
33for vvv in `echo $vvvv | sed -e 's/:/ /g'` ; do
34   listetmp="`echo $vvv | sed -e 's/,/ /g'`"
35   # Ecriture d'une ligne de 3 variables
36   for vv in $listetmp ; do echo '<TD>' $vv '</TD>' ; done
37   echo '<TR>' 
38   for vv in $listetmp ; do
39       file=$PNG_D/${vv}.png
40       if [ -f $file ] ; then
41          thredds=`echo $file | sed -e 's:/modfs/ipslfs/dods/:http\://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/:'`
42          echo '<TD ALIGN=CENTER><A HREF="'$thredds'"><IMG HEIGHT=250 WIDTH=350 SRC="'$thredds'"></a></TD>'
43       else
44          echo '<TD>' Missing '</TD>'
45       fi
46   done
47   echo '<TR>'
48done
49
50
51cat <<eod
52</table>
53eod
54
55
56# Version Latex pdf
57
58# Calcul du nombre de colonnes pour le tableau
59nnn=0
60for vvv in `echo $vvvv | sed -e 's/:/ /g'` ; do
61   nn=`echo $vvv | sed -e 's/,/ /g' | wc -w`
62   if [ $nn  -gt $nnn ] ; then nnn=$nn ; fi
63done
64lll="" ; i=0 ; while [ $i != $nnn ] ; do lll="${lll}l" ; (( i = i + 1 )) ; done
65
66
67cat <<eod>| $PNG_D/index.tex
68\documentclass{article}
69\RequirePackage[babel,multidot,extendedchars,space]{grffile}
70\usepackage{a4}
71\usepackage{longtable}
72\usepackage[landscape]{geometry}
73\textwidth 27cm
74\oddsidemargin -2cm
75\topmargin -3cm
76\textheight 20cm
77\def\sizea{5cm}
78\def\sizeb{8cm}
79\pagestyle{empty}
80\usepackage{graphicx}
81\begin{document}
82\begin{longtable}{$lll}
83eod
84
85for vvv in `echo $vvvv | sed -e 's/:/ /g'` ; do
86   listetmp="`echo $vvv | sed -e 's/,/ /g'`"
87   # Ecriture d'une ligne de 3 variables
88   i=0
89   for vv in $listetmp ; do
90       (( i = $i + 1 )) ; if [ $i = `echo $listetmp | wc -w` ] ; then sep="" ; else sep='&' ; fi
91       file=$PNG_D/${vv}.png
92       if [ -f $file ] ; then
93          echo '\includegraphics[width=\sizea]{'$file'} '$sep >> $PNG_D/index.tex
94       else
95          echo Missing >> $PNG_D/index.tex
96       fi
97   done
98   echo '\\'  >> $PNG_D/index.tex
99   i=0
100   for vv in $listetmp ; do
101       (( i = $i + 1 )) ; if [ $i = `echo $listetmp | wc -w` ] ; then sep="" ; else sep='&' ; fi
102       echo  $vv $sep  | sed -e 's/\_/\\_/g'  >> $PNG_D/index.tex
103   done
104   echo '\\'  >> $PNG_D/index.tex
105done
106
107
108cat <<eod>> $PNG_D/index.tex
109\end{longtable}
110\end{document}
111eod
112
113cd $PNG_D
114pdflatex index > out.tex 2>&1 
Note: See TracBrowser for help on using the repository browser.