[1523] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | ########################################################### |
---|
| 4 | fh=$1 |
---|
| 5 | echo "" > $fh |
---|
| 6 | shift 1 |
---|
| 7 | smooth=$1 |
---|
| 8 | shift 1 |
---|
| 9 | file=$1 |
---|
| 10 | shift 1 |
---|
| 11 | DIRS=$@ |
---|
| 12 | for 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}) |
---|
| 29 | done |
---|
| 30 | ########################################################### |
---|
| 31 | |
---|
| 32 | cmd="!============================" |
---|
| 33 | printf "$cmd\n" >> $fh |
---|
| 34 | cmd="! Script generated by FEGGsh (Ferret in an EGG in bash)\n" |
---|
| 35 | printf "$cmd\n" >> $fh |
---|
| 36 | # mode linecolors is an undocumented mode (beta) |
---|
| 37 | # /thick does not work |
---|
| 38 | cmd="set mode linecolors 30" |
---|
| 39 | printf "$cmd\n" >> $fh |
---|
| 40 | cmd="set window/size=0.4 1 ; cancel mode logo" |
---|
| 41 | printf "$cmd\n" >> $fh |
---|
| 42 | cmd="set view full ; go margins_set 15 30 10 08" |
---|
| 43 | printf "$cmd\n" >> $fh |
---|
| 44 | cmd="\n!============================" |
---|
| 45 | printf "$cmd\n" >> $fh |
---|
| 46 | cmd="!Please change the colors or/and legends if needed" |
---|
| 47 | printf "$cmd\n" >> $fh |
---|
| 48 | cmd='let colors={"3B63E6", "FF4500", "FFE000", "34D314", "FF1392", "FFA400", "775BB4", "F5E6BD", "789BF1", "AFDFE6", "0000C7", "1FB1AA", "B12121", "DEB886", "FFB6C1"}' |
---|
| 49 | printf "$cmd\n" >> $fh |
---|
| 50 | cmd="! Color for graticule" |
---|
| 51 | printf "$cmd\n" >> $fh |
---|
| 52 | cmd="ppl color 6, 80, 80, 80" |
---|
| 53 | printf "$cmd\n" >> $fh |
---|
| 54 | nd=1 |
---|
| 55 | for 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 |
---|
| 60 | done |
---|
| 61 | cmd="\n!============================" |
---|
| 62 | printf "$cmd\n" >> $fh |
---|
| 63 | cmd="def symbol FILE=(\$01%%$file%%)" |
---|
| 64 | printf "$cmd\n\n" >> $fh |
---|
| 65 | nd=0 |
---|
| 66 | for s in ${alldir[@]} ; do |
---|
| 67 | cmd="use \"$s/MONITORING/files/(\$FILE)\"" |
---|
| 68 | printf "$cmd\n" >> $fh |
---|
| 69 | let nd=nd+1 |
---|
| 70 | done |
---|
| 71 | cmd="\ndef symbol NVAR1=\`..nvars\`" |
---|
| 72 | printf "$cmd\n" >> $fh |
---|
| 73 | cmd="def symbol VAR1=\`..varnames[i=(\$NVAR1)]\`" |
---|
| 74 | printf "$cmd\n" >> $fh |
---|
| 75 | cmd="def symbol SMOOTH=(\$02%%$smooth%%)" |
---|
| 76 | printf "$cmd\n" >> $fh |
---|
| 77 | cmd="let var=(\$VAR1)[L=@SBX:(\$SMOOTH)]" |
---|
| 78 | printf "$cmd\n" >> $fh |
---|
| 79 | cmd="\n!============================" |
---|
| 80 | printf "$cmd\n" >> $fh |
---|
| 81 | cmd="plot/nolab/line/grat=(dash,color=6) var[d=1]" |
---|
| 82 | i=2 |
---|
| 83 | while [ $i -le $nd ] ; do |
---|
| 84 | cmd="$cmd, var[d=$i]" |
---|
| 85 | let i=i+1 |
---|
| 86 | done |
---|
| 87 | printf "$cmd\n" >> $fh |
---|
| 88 | nd=1 |
---|
| 89 | for 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 |
---|
| 94 | done |
---|
| 95 | cmd="\n!============================" |
---|
| 96 | printf "$cmd\n" >> $fh |
---|
| 97 | cmd="define view/x=0:1/y=0:1 full2 ; set view full2" |
---|
| 98 | printf "$cmd\n" >> $fh |
---|
| 99 | cmd="go margins_set 15 30 10 08" |
---|
| 100 | printf "$cmd\n" >> $fh |
---|
| 101 | cmd="plot/nolab/noaxis i[i=1:5]*0-1E34 ! plot nothing, needed to define symbols used by text_legend_put" |
---|
| 102 | printf "$cmd\n" >> $fh |
---|
| 103 | xpos1=10; yposstart=20; ypos=$yposstart |
---|
| 104 | nd=1 |
---|
| 105 | for 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 |
---|
| 116 | done |
---|
| 117 | cmd="\n!============================" |
---|
| 118 | printf "$cmd\n" >> $fh |
---|
| 119 | cmd="go text_put 05 95 \"@AS\`(\$VAR1),return=dset\`.nc\" -1 0.3" |
---|
| 120 | printf "$cmd\n" >> $fh |
---|
| 121 | cmd="go text_put 10 90 \"@AS\`(\$VAR1),return=title\` (\`(\$VAR1),return=units\`) (@SBX:(\$SMOOTH))\" -1 0.35" |
---|
| 122 | printf "$cmd\n" >> $fh |
---|
| 123 | cmd="\n!============================" |
---|
| 124 | printf "$cmd\n" >> $fh |
---|