rain4.gplot 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ############################
  2. # Display the temperature and the humidity values of a Oregon PCR800 rain gauge
  3. #
  4. # FileLog definition:
  5. # define <filelogname> FileLog /var/log/fhem/<devname>-%Y.log <devname>
  6. # Filelog example:
  7. # define FileLog_PCR800_7a FileLog /var/log/fhem/PCR800_7a-%Y.log PCR800_7a.*rain.*
  8. #
  9. # Logfile record example:
  10. # 2010-08-16_19:44:34 PCR800_7a rain_rate: 0
  11. # 2010-08-16_19:44:35 PCR800_7a rain_total: 2.08
  12. set terminal png transparent size <SIZE> crop
  13. set output '<OUT>.png'
  14. set xdata time
  15. set timefmt "%Y-%m-%d_%H:%M:%S"
  16. set xlabel " "
  17. set ytics nomirror
  18. set y2tics
  19. set title '<L1>'
  20. set grid
  21. set y2label "Rain rate mm/hr"
  22. set format y "%0.1f"
  23. set ylabel "Rain (l/m2)"
  24. set yrange [0:]
  25. # Computing Rain/h and Rain/d values by accumulating the changes.
  26. #FileLog 4:rain_rate:0:
  27. #FileLog 4:rain_total:0:delta-h
  28. #FileLog 4:rain_total:0:delta-d
  29. plot "< awk $3=="rain_rate:" {print $1, $4}' <IN>"\
  30. using 1:2 axes x1y2 title 'Rain Rate' with lines,\
  31. "<grep rain_total <IN> | perl -ane '\
  32. @a = split(\" \", $F[0]);\
  33. if(defined($lh) && $lh ne $a[1])\
  34. { printf(\"${ld}_$lh:30:00 %f\n\", $hv); $hv = 0; }\
  35. if($lv) { $hv += ($F[4]-$lv); }\
  36. $lh = $a[1]; $ld = $a[0]; $lv = $F[4];\
  37. END { printf(\"${ld}_$lh:30:00 %f\n\", $hv) }'"\
  38. using 1:2 axes x1y1 title 'Rain/h' with histeps,\
  39. "<grep rain_total <IN> | perl -ane '\
  40. @a = split(\" \", $F[0]);\
  41. if(defined($ld) && $ld ne $a[0]) {\
  42. printf(\"${ld}_12:00:00 %f\n\", $dv); $dv = 0; }\
  43. if($lv) { $dv += ($F[4]-$lv); }\
  44. $ld = $a[0]; $lv = $F[4];\
  45. END {printf(\"${ld}_12:00:00 %f\n\", $dv)}'"\
  46. using 1:2 axes x1y1 title 'Rain/day' with histeps