source: TOOLS/MultiMonitoring/plot02.bash @ 1836

Last change on this file since 1836 was 1523, checked in by mmaipsl, 13 years ago

Patrick, Martial : translation in shell script of Multi-Monitoring web service.

  • Property svn:executable set to *
File size: 3.7 KB
Line 
1#!/bin/bash
2
3###########################################################
4fh=$1
5echo "" > $fh
6shift 1
7smooth=$1
8shift 1
9file=$1
10shift 1
11DIRS=$@
12for thisdir in ${DIRS[@]} ; do
13    echo ""
14    leadding_sl=$( echo ${thisdir} | grep '.*/$' )
15    if [ X"${leadding_sl}" != X ] ; then
16        thisdir=$( echo ${thisdir} | sed -e 's&\(.*\)/$&\1&' )
17    fi
18    echo "dir : " ${thisdir}
19
20    http_dir=$( echo ${thisdir} | grep "http://" )
21    if [ X"${http_dir}" != X ] ; then
22        cgi=$( echo ${thisdir} | grep "cgi-bin/nph-dods" )
23        if [ X"${cgi}" = X"" ] ; then
24            thisdir=$( echo ${thisdir} | sed -e "s&http://\([^/]*\)/&http://\1/cgi-bin/nph-dods/&" )
25        fi
26        echo "new dir name : " ${thisdir}
27    fi
28    alldir=(${alldir[@]} ${thisdir})
29done
30###########################################################
31
32cmd="!============================"
33printf "$cmd\n" >> $fh
34cmd="! Script generated by FEGGsh (Ferret in an EGG in bash)\n"
35printf "$cmd\n" >> $fh
36# mode linecolors is an undocumented mode (beta)
37# /thick does not work
38cmd="set mode linecolors 30"
39printf "$cmd\n" >> $fh
40cmd="set window/size=0.4 1 ; cancel mode logo"
41printf "$cmd\n" >> $fh
42cmd="set view full ; go margins_set 15 30 10 08"
43printf "$cmd\n" >> $fh
44cmd="\n!============================"
45printf "$cmd\n" >> $fh
46cmd="!Please change the colors or/and legends if needed"
47printf "$cmd\n" >> $fh
48cmd='let colors={"3B63E6", "FF4500", "FFE000", "34D314", "FF1392", "FFA400", "775BB4", "F5E6BD", "789BF1", "AFDFE6", "0000C7", "1FB1AA", "B12121", "DEB886", "FFB6C1"}'
49printf "$cmd\n" >> $fh
50cmd="! Color for graticule"
51printf "$cmd\n" >> $fh
52cmd="ppl color 6, 80, 80, 80"
53printf "$cmd\n" >> $fh
54nd=1
55for s in ${alldir[@]} ; do
56        let ncolor=nd+6     # Users colors will begin at 7
57        cmd="go set_color_from_hexa $ncolor \`colors[i=$nd]\`"
58        printf "$cmd\n" >> $fh
59        let nd=nd+1
60done
61cmd="\n!============================"
62printf "$cmd\n" >> $fh
63cmd="def symbol FILE=(\$01%%$file%%)"
64printf "$cmd\n\n" >> $fh
65nd=0
66for s in ${alldir[@]} ; do
67        cmd="use \"$s/MONITORING/files/(\$FILE)\""
68        printf "$cmd\n" >> $fh
69        let nd=nd+1
70done
71cmd="\ndef symbol NVAR1=\`..nvars\`"
72printf "$cmd\n" >> $fh
73cmd="def symbol VAR1=\`..varnames[i=(\$NVAR1)]\`"
74printf "$cmd\n" >> $fh
75cmd="def symbol SMOOTH=(\$02%%$smooth%%)"
76printf "$cmd\n" >> $fh
77cmd="let var=tsequence((\$VAR1)[L=@SBX:(\$SMOOTH)])"
78printf "$cmd\n" >> $fh
79cmd="\n!============================"
80printf "$cmd\n" >> $fh
81cmd="plot/nolab/line/grat=(dash,color=6) var[d=1]"
82i=2
83while [ $i -le $nd ] ; do
84        cmd="$cmd, var[d=$i]"
85        let i=i+1
86done
87printf "$cmd\n" >> $fh
88nd=1
89for s in ${alldir[@]} ; do
90        let ncolor=nd+6     # Users colors will begin at 7
91        cmd="plot/nolab/over/color=$ncolor/line var[d=$nd]"
92        printf "$cmd\n" >> $fh
93        let nd=nd+1
94done
95cmd="\n!============================"
96printf "$cmd\n" >> $fh
97cmd="define view/x=0:1/y=0:1 full2 ; set view full2"
98printf "$cmd\n" >> $fh
99cmd="go margins_set 15 30 10 08"
100printf "$cmd\n" >> $fh
101cmd="plot/nolab/noaxis i[i=1:5]*0-1E34 ! plot nothing, needed to define symbols used by text_legend_put"
102printf "$cmd\n" >> $fh
103xpos1=10; yposstart=20; ypos=$yposstart
104nd=1
105for s in ${alldir[@]} ; do
106        let ncolor=nd+6     # Users colors will begin at 7
107        if [ $ypos -lt 4 ] ; then
108                ypos=$yposstart
109                xpos1=40
110        fi
111        let xpos2=xpos1+10
112        cmd="go text_legend_put $xpos1 $xpos2 $ypos \"@AS`basename $s`\" $ncolor 0.35"
113        let ypos=ypos-3
114        printf "$cmd\n" >> $fh
115        let nd=nd+1
116done
117cmd="\n!============================"
118printf "$cmd\n" >> $fh
119cmd="go text_put 05 95 \"@AS\`(\$VAR1),return=dset\`.nc\" -1 0.3"
120printf "$cmd\n" >> $fh
121cmd="go text_put 10 90 \"@AS\`(\$VAR1),return=title\` (\`(\$VAR1),return=units\`) (@SBX:(\$SMOOTH))\" -1 0.35"
122printf "$cmd\n" >> $fh
123cmd="\n!============================"
124printf "$cmd\n" >> $fh
Note: See TracBrowser for help on using the repository browser.