Loading

CROP

bucketize

The CROP function works on bucketized Geo Time Series™ instances, if transforms a GTS into another one whose bucketcount, last bucket parameters span the smallest interval with actual values. Bucket span remains the same.

When called on a non bucketized GTS instance, CROP simply clones it.

This function expects a list of GTS instances on the top of the stack.

CROP is available since version 1.0.0.

See also

Signatures

Examples

[ NEWGTS 'GTS1' RENAME 300 NaN NaN NaN 8 ADDVALUE 400 NaN NaN NaN 7 ADDVALUE 500 NaN NaN NaN 6 ADDVALUE 700 NaN NaN NaN 42 ADDVALUE 800 NaN NaN NaN 42 ADDVALUE 900 NaN NaN NaN 3 ADDVALUE 950 NaN NaN NaN 1 ADDVALUE NEWGTS 'GTS2' RENAME 100 NaN NaN NaN 1 ADDVALUE 700 NaN NaN NaN 42 ADDVALUE 800 NaN NaN NaN 42 ADDVALUE 1100 NaN NaN NaN 1 ADDVALUE ] // bucket span 200, bucket count 1150 (far too much in the past), last bucket 1600 (too far in the future) [ SWAP bucketizer.last 1600 200 1150 ] BUCKETIZE 'b' STORE // adjust last bucket and bucket count for each gts in the input list $b CROP 'c' STORE [ 'before/after crop: bucket count GTS1' [ $b 0 GET BUCKETCOUNT $c 0 GET BUCKETCOUNT ] ] [ 'before/after crop: last bucket GTS1' [ $b 0 GET LASTBUCKET $c 0 GET LASTBUCKET ] ] '' [ 'before/after crop: bucket count GTS1' [ $b 1 GET BUCKETCOUNT $c 1 GET BUCKETCOUNT ] ] [ 'before/after crop: last bucket GTS1' [ $b 1 GET LASTBUCKET $c 1 GET LASTBUCKET ] ]