Technical Support for Environmental Data Collection Software
Email This Article
Your Name: *  
Your Email: *
Friend's Email: *
  *Required Field
Verification Code: *

Decode at longer interval than logger

  • Author: Michael Maloney
  • Create Time: 01/08/2013 11:00:13
  • Last Update Time: 01/08/2013 11:04:21
A common use case: The logger records stage every 5 minutes but I only want it every 15 minutes.

DECODES extracts data from the message according to the script you provide. It is easy to write a script that skips over samples you do not want. See the DECODES Reference Manual chapter on the DECODES Format Language for details.

The operators that skip over data include: x, /, w, s

x is used to skip a character. It advances the data pointer to the right regardless of the current character. It may be preceeded with a number. 3x means to skip three characters. It should be used with care because it is not sensitive to the current character.

/ means to skip to the beginning of the next line. It handles linefeeds and carriage return combinations. It also may be preceeded with a number. 2/ means to skip to the start of the 2nd line hence.

w means to skip any amount of white-space starting with the current character. "White space" includes spaces, tabs, carriage returns, and linefeeds. If the current character is not a space, this operator does nothing, so it is a fairly safe thing to do.

s is the scan operator. It has many options. See the DECODES reference manual for details. A common use is to scan ahead for some pattern in the data. For example, to scan ahead 40 characters for a colon, use:
   s(40, ':', error)
This scans at most 40 characters for a single colon. If it finds it, it leaves the pointer on the colon. If not, it jumps to the statement labeled 'error'.

Back to the problem at hand: suppose we have 12 5-minute samples is as follows:
0.05 0.11 0.16 0.17 0.19 0.25 0.35 0.62 0.91 1.05 1.15 1.20

We want to grab every third sample (15 minute) for sensor number 1. We could do something like this:
   4(w, f(s, a, 6d' ', 1), 2(w, x, s(10, ' ', error)))

Now in the Config Sensor Dialog, tell it that you are decoding 15 minute data.
Explanation of the script:
  • Outer loop is 4 times. There are 4 15-min samples.
    • We skip white space and decode the sensor field
    • Inner loop: twice to skip two unwanted samples
      • skip white space
      • skip a single character (putting us into a number field)
      • Use scan operator to skip non-white space