Skipping data file with no valid points

Help
2010-03-22
2013-02-10
  • Hi,
    i would like to plot some data from a data aquisition system. If a sensor breaks or data validation fails it will output a value of -9999.99.

    Plots work fine, except i have only -9999.99 values in a column. Then i get the following errors:
    "def.gnuplot", line 9: warning: Skipping data file with no valid points
    "def.gnuplot", line 9: all points y value undefined!
    and the script stops leaving the following plots undone.
    Is there any way to ignore those warnings and force gnuplot to print an empty plot?

    I tried the folowing script on gnuplot 4.0 (solaris) and 4.2 (OSX)

    set terminal png small size 550,310
    set xdata time
    set datafile missing "-9999.99"
    set timefmt '%H%M%S'
    set format x '%H:%M'
    set xrange
    set output '/foo/1.png'
    plot '/foo/foo.data' using 1:3 with lines lw 2
    set output '/foo/2.png'
    plot '/foo/foo.data' using 1:2 with lines ls 1

    data file:
    000000 1 -9999.99
    000100 2 -9999.99
    000200 3 -9999.99
    000300 4 -9999.99
    000400 5 -9999.99
    000500 6 -9999.99
    000600 7 -9999.99
    000700 8 -9999.99
    000800 9 -9999.99
    000900 10 -9999.99

    Thanks Paul

     
  • Edoardo Pasca
    Edoardo Pasca
    2010-03-22

    Hi,

    sometimes i preprocess the file to be plotted with awk from within gnuplot. If you want to skip completely the wrong row you could use something like this:

    plot "<awk '{if ($2 == -9999.99) print "#" $0; else print $0}' /foo/foo.data" using 1:2 with lines ls 1

    Edo

     
  • Hi Edo,
    thanks for your fast help. Skipping complete rows works only in single plots, but i have many plots with multiple graphs.
    Any other idea? I am not shure, but i think former versions of gnuplot had no problem with empty columns, is'nt it?

    Paul

     
  • Edoardo Pasca
    Edoardo Pasca
    2010-03-22

    Hi Paul,

    it's not clear to me what you mean. Are you  in  a multiplot environment? Do you plot multiple things on a single graph like
    plot "foo.bar" u 1:2, "foo.bar2" u 1:2 , "foo.bar2" u 1:3
    ?
    You can preprocess any/all the files in the plot call as
    plot "<awk -f filter.awk foo.bar" u 1:2 , "<awk -f filter.awk foo.bar2" u 1:2 , "<awk -f filter.awk" u 1:3

    where filter.awk contains
    {if ($2==-9999.99) print "#" $0; else print $0}

    Ciao

    Edo

     
  • Hi Edo,
    ok that would work on multiplots like i have, but the problem still remains. If i have a dataset like above where one column contains only -9999.99, awk comment all lines and gnuplot stops with the same warnings.
    Any further ideas?

    Thanks Paul