Créer des profils du manteau neigeux - retour accueil
git clone git://bebou.netlib.re/gelinive
Log | Files | Refs | README |
commit 6d5728cd0a32277285f64528476f4dbe2b59fa1f parent ab3e46c5cc31a2b9867e85c5057eb62e268e0f4d Auterice: Arthur Pons <arthur.pons@unistra.fr> Date: Fri, 15 Mar 2024 18:47:33 +0100 Retrait de la dépendance à imagemagick Avec l'utilisation du style boxxy de gnuplot il est possible de créer des histogrammes horizontaux. En adaptant geliniveplot, l'appel dans gelinive et les tests on peut donc officiellement retirer la dépendance. Puisque l'on utilise plus convert, imagemagick n'ajoute plus de métadonnées et donc on peut réutiliser cmp pour comparer les images bit à bit plutôt que pixel par pixel. J'aime bien ce genre de commits :) Diffstat:
M | README.md | | | 1 | - |
M | geliniveplot | | | 145 | +++++++++++++++++++++++++++++++++++++++---------------------------------------- |
M | gelinivetest | | | 33 | +-------------------------------- |
M | tests/hohneck.png | | | 0 | |
M | tests/miribel.png | | | 0 | |
M | tests/test | | | 3 | ++- |
6 files changed, 74 insertions(+), 108 deletions(-)
diff --git a/README.md b/README.md @@ -21,7 +21,6 @@ Les dépendances notables sont : * sed * gnuplot 5.4 * dash - * ImageMagick (convert pour tourner l'image et compare pour les tests) Pour tester le logiciel faire diff --git a/geliniveplot b/geliniveplot @@ -1,69 +1,64 @@ #! /usr/bin/gnuplot -c # -# +# # G N U P L O T -# Version 5.4 patchlevel 4 last modified 2022-07-10 -# +# Version 5.4 patchlevel 4 last modified 2022-07-10 +# # Copyright (C) 1986-1993, 1998, 2004, 2007-2022 # Thomas Williams, Colin Kelley and many others -# +# # gnuplot home: http://www.gnuplot.info # faq, bugs, etc: type "help FAQ" # immediate help: type "help" (plot window: hit 'h') -# set terminal qt 0 font "Sans,9" -set term pngcairo size 1000,500 font "Sans,12" -# set terminal dumb size 150 75 -# set output "|feh -" +# set terminal qt 0 size 500, 1000 font "Sans,12" +set term pngcairo size 500,1000 font "Sans,12" +# set output unset clip points set clip one unset clip two unset clip radial -set errorbars front 1.000000 +set errorbars front 1.000000 set border 31 front lt black linewidth 3.000 dashtype solid -set zdata -set ydata -set xdata -set y2data -set x2data +set zdata +set ydata +set xdata +set y2data +set x2data set boxwidth set boxdepth 0 -set style fill transparent solid 1 -set style rectangle back fc bgnd fillstyle solid 1.00 border lt -1 -set style circle radius graph 0.02 +set style fill transparent solid 1.00 border +set style rectangle back fc bgnd fillstyle solid 1.00 border lt -1 +set style circle radius graph 0.02 set style ellipse size graph 0.05, 0.03 angle 0 units xy set dummy x, y -set format x "% h" -set format y "% h" -set format x2 "% h" -set format y2 "-% h" -set format z "% h" -set format cb "% h" -set format r "% h" +set format x "% h" +set format y "% h" +set format x2 "% h" +set format y2 "% h" +set format z "% h" +set format cb "% h" +set format r "% h" set ttics format "% h" set timefmt "%d/%m/%y,%H:%M" set angles radians set tics back -set grid nopolar -set grid xtics nomxtics ytics nomytics noztics nomztics nortics nomrtics \ - nox2tics nomx2tics y2tics nomy2tics nocbtics nomcbtics -set grid front lt 0 linewidth 1.200 unset grid unset raxis set theta counterclockwise right set style parallel front lt black linewidth 2.000 dashtype solid -set key noautotitle -set key at 300,110 horizontal noreverse enhanced noautotitle nobox -set key noinvert samplen 0.1 spacing 0 width 0 height 0 +set key notitle +set key fixed right top vertical Right noreverse enhanced autotitle nobox +set key noinvert samplen 4 spacing 1 width 0 height 0 set key maxcolumns 0 maxrows 0 set key noopaque unset label unset arrow unset style line unset style arrow -set style histogram clustered gap 0 +set style histogram clustered gap 2 title textcolor lt -1 unset object unset walls -set style textbox transparent margins 1.0, 1.0 border lt -1 linewidth 1.0 +set style textbox transparent margins 3.0, 3.0 border lt -1 linewidth 1.0 set offsets 0, 0, 0, 0 set pointsize 1 set pointintervalbox 1 @@ -105,50 +100,55 @@ unset y2zeroaxis set xyplane relative 0.5 set tics scale 1, 0.5, 1, 1, 1 set mxtics 4.000000 -set mytics 2.000000 -set my2tics 4.000000 +set mytics default set mztics default -set mx2tics default +set mx2tics 4.000000 +set my2tics 4.000000 set mcbtics default set mrtics default set nomttics -set xtics border out scale 1,0.5 nomirror rotate by -90 autojustify -set xtics norangelimit 20 -set ytics border out scale 1,0.5 nomirror rotate by -90 offset character 0, -0.5, 0 autojustify -set ytics norangelimit 20 -set y2tics border out scale 1,0.5 nomirror rotate by -90 offset character 0, +1, 0 autojustify -set y2tics norangelimit 4 -set ztics border out scale 1,0.5 nomirror norotate autojustify -set ztics norangelimit autofreq -unset x2tics +set xtics border out scale 1,0.35 nomirror norotate autojustify +#set xtics norangelimit +set xtics ('0' 0 0, '5' -5 1, '10' -10 1, '15' -15 1, '20' -20 0, '25' -25 1, '30' -30 1, '35' -35 1, '40' -40 0, '45' -45 1, '50' -50 1, '55' -55 1, '60' -60 0, '65' -65 1, '70' -70 1, '75' -75 1, '80' -80 0, '85' -85 1, '90' -90 1, '95' -95 1, '100' -100 0, '105' -105 1, '110' -110 1, '115' -115 1, '120' -120 0, '125' -125 1, '130' -130 1, '135' -135 1, '140' -140 0) +unset ytics +set ztics border in scale 1,0.5 nomirror norotate autojustify +set ztics norangelimit autofreq +set x2tics border out scale 1,0.35 nomirror norotate autojustify +set x2tics norangelimit 4 +set y2tics border out scale 1,0.35 nomirror norotate autojustify +set y2tics norangelimit 20 set cbtics border in scale 1,0.5 mirror norotate autojustify -set cbtics norangelimit autofreq +set cbtics norangelimit autofreq set rtics axis in scale 1,0.5 nomirror norotate autojustify -set rtics norangelimit autofreq +set rtics norangelimit autofreq unset ttics -set timestamp bottom -set timestamp "" +set title "" +set title font "" textcolor lt -1 norotate +set timestamp bottom +set timestamp "" set timestamp font "" textcolor lt -1 norotate set trange [ * : * ] noreverse nowriteback set urange [ * : * ] noreverse nowriteback set vrange [ * : * ] noreverse nowriteback -set xlabel "Hauteur de neige (cm)" +set xlabel "Résistance à l'abbatage (Kg)" set xlabel font "" textcolor lt -1 norotate -set xrange [ 0.00000 : 310.000 ] noreverse writeback -set x2range [ * : * ] noreverse writeback -set ylabel "Résistance au battage (Kg)" -set ylabel offset character 2, -1, 0 font "" textcolor lt -1 rotate by -90 -set y2label "Température (°C)" -set y2label offset character -1.5, 0, 0 font "" textcolor lt -1 rotate by -90 -set yrange [ 0.00000 : 125.000 ] noreverse writeback -set y2range [ 0 : 25 ] noreverse writeback -set zlabel "" +set x2label "Température (\302\260C)" +set x2label font "" textcolor lt -1 norotate +set xrange [ -140.000 : 0.00000 ] noreverse writeback +set x2range [ -24.0000 : 0.00000 ] noreverse writeback +set ylabel "" +set ylabel font "" textcolor lt -1 rotate +set y2label "Hauteur de neige (cm)" +set y2label font "" textcolor lt -1 rotate +set yrange [ -1.77636e-14 : 300.000 ] noreverse writeback +set y2range [ -1.77636e-14 : 300.000 ] noreverse writeback +set zlabel "" set zlabel font "" textcolor lt -1 norotate set zrange [ * : * ] noreverse writeback -set cblabel "" +set cblabel "" set cblabel font "" textcolor lt -1 rotate set cbrange [ * : * ] noreverse writeback -set rlabel "" +set rlabel "" set rlabel font "" textcolor lt -1 norotate set rrange [ * : * ] noreverse writeback unset logscale @@ -162,34 +162,31 @@ set locale "fr_FR.UTF-8" set pm3d explicit at s set pm3d scansautomatic set pm3d interpolate 1,1 flush begin noftriangles noborder corners2color mean -set pm3d clip z +set pm3d clip z set pm3d nolighting -set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB +set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB set palette rgbformulae 7, 5, 15 set colorbox default set colorbox vertical origin screen 0.9, 0.2 size screen 0.05, 0.6 front noinvert bdefault set style boxplot candles range 1.50 outliers pt 7 separation 1 labels auto unsorted -set loadpath +set loadpath set fontpath set psdir set fit brief errorvariables nocovariancevariables errorscaling prescale nowrap v5 GNUTERM = "qt" I = {0.0, 1.0} -VoxelDistance = 0.0 -x = 0.0 -set style textbox opaque noborder -set label ARG1 at 343,25 rotate by -90 left boxed -set label "Résistance au battage (Kg)" at 280,105 rotate by -90 left boxed -set label "Température (°C)" at 294,105 rotate by -90 left boxed + +set label 1 ARG1 at -130.000, 265.000, 0.00000 left norotate back nopoint boxed histofromstdin(x)=sprintf("< sed '2,$ p' |\ -awk '{\ +awk 'BEGIN{OFS=\"\t\"} {\ l=NR;hc=$8;r=$7;getline;\ if(l==NR) {hn=0} else {hn=$8};\ -for(i=hc;i>hn;i--) {print r}\ +for(i=hc;i>hn;i--) {print i,r}\ }' |\ sed '1!G;h;$!d'") -## Last datafile plotted: "histodata" -plot histofromstdin("") u 1 w histogram title ' ' lc rgbcolor "#aad9f3", ARG2 u 1:($2*-1) w lp axes x1y2 pt 7 lw 2 lc rgbcolor "#c97fe8" title ' ' +VoxelDistance = 0.0 +## Last datafile plotted: "hohnecktemp" +plot histofromstdin("") u (0):(0):(-$2):(0):($1-1):($1+1) w boxxy title "Résistance à l'abbatage (Kg)" lc rgbcolor "#aad9f3", ARG2 u ($2):1 w lp axes x2y1 pt 7 lw 2 lc rgbcolor "#c97fe8" title "Température °C" # EOF diff --git a/gelinivetest b/gelinivetest @@ -28,36 +28,6 @@ en intégrant une vraie gestion des arguments avec des options. exit 0 fi -# Rend les données contenues dans le profil plus faicle à afficher avec gnuplot -# -# En gros : -# -# 1 80 -> 80 1 -# 2 37 79 1 -# 3 21 ... -# 4 2 38 1 -# 37 2 -# ... -# 22 2 -# 21 3 -# ... -# 3 3 -# 2 4 -# ... -# -makehistodata() { -sed '$ a\ -0 0 0 0 0 0 0 0 -2,$ p' | -awk '{ - rcur=$7;hcur=$8 - getline - rnext=$7;hnext=$8 - for(i=hcur;i>hnext;i--) {print i" "rcur} -}' | -tr '/' '1' -} - # Calcule les variables R e et H et les ajoute à la fin de change ligne calc_R_e_H() { awk -vH="$1" -vOFS='\t' ' @@ -76,6 +46,5 @@ cat $1 > $tempdir/profil # On stocke les données dans u topheight=$(tail -n1 $tempdir/profil | cut -f5) # On récupère le dernier champ de la dernière ligne < $tempdir/profil calc_R_e_H $topheight | # On met dans stdin de la fonction les données, en argument la hauteur tee "$3" 2> /dev/null | # On stocke le résultat dans un fichier, si l'argument existe - ./geliniveplot "$2" "$4" 2> /dev/null | # On créé le graph, premier arg = fichier temp, second = titre - convert - -rotate -90 - # On tourne l'image pour qu'elle soit en format portrait + ./geliniveplot "$2" "$4" 2> /dev/null # On créé le graph, premier arg = fichier temp, second = titre diff --git a/tests/hohneck.png b/tests/hohneck.png Binary files differ. diff --git a/tests/miribel.png b/tests/miribel.png Binary files differ. diff --git a/tests/test b/tests/test @@ -17,7 +17,8 @@ printf "Test du fichier $file | " printf "tab " cmp --silent tests/${file}tab $tempdir/${file}tab && pass || fail printf " image " -compare -metric AE tests/$file.png $tempdir/$file.png /dev/null 2> /dev/null && pass || fail +cmp --quiet tests/$file.png $tempdir/$file.png && pass || fail +# compare -metric AE tests/$file.png $tempdir/$file.png /dev/null 2> /dev/null && pass || fail echo done