Skip to content

Instantly share code, notes, and snippets.

@PierreZ
Created July 14, 2016 18:00
Show Gist options
  • Save PierreZ/7846be3111e6c2eb8cae8a403df1fb73 to your computer and use it in GitHub Desktop.
Save PierreZ/7846be3111e6c2eb8cae8a403df1fb73 to your computer and use it in GitHub Desktop.
'2016-07-11T00:00:00.000000Z' // Start of measures
'BEGIN' STORE
''
'TOKEN' STORE // Read token
'=torque.litres.per.100.kilometer.long.term.average' 'CLASSNAME' STORE // Classname Selector
//'=torque.speed.obd' 'CLASSNAME' STORE // Classname Selector
//'~.*' 'CLASSNAME' STORE // Classname Selector
{} 'LABEL' STORE // Label list to filter
[
$TOKEN
$CLASSNAME
$LABEL
$BEGIN // Start TS
NOW ISO8601 // End TS
] FETCH // Fetch the data
{ 'id' '' } RELABEL
// bucketizer is simply a downsampling of our fetched data
[
SWAP // Swap is pushing here the value stacked
bucketizer.mean
0 // lastbucket
10 s // bucketspan
0 // bucketcount
] BUCKETIZE
// Let's create a gts for each trip
5 m // Quiet period
10 // Min number of values
'subTrip' // Label
TIMESPLIT
0 GET // Get the first list (timesplit is sending a list of list)
UNBUCKETIZE
[
SWAP // Swap is pushing here the value stacked
bucketizer.mean
0 // lastbucket
0 // bucketspan
1 // bucketcount
] BUCKETIZE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment