Loading

BUCKETIZE.CALENDAR


framework bucketize gts bucketizer date
Since v2.4.1
Available on all platforms
See also

Creates bucketized Geo Time Series with buckets that span a calendar duration that can be irregular (e.g. taking into account leap years and daylight saving time).

Instead of using a bucketspan like the BUCKETIZE framework, it uses a bucketduration: a STRING in ISO 8601 duration format, as PyYmMwWdDThHmMsS similarly to that of ADDDURATION function. However, complex bucketdurations that can be non-positive from some ticks are not allowed.

In the result, the tick of each bucket is its index, which is equal to the number of buckets that are ended since Unix Epoch. In particular, the tick of the bucket that contains Unix Epoch is always 0. The resulting GTS is considered bucketized for further operations. Then, the function UNBUCKETIZE.CALENDAR can be used to replace bucket indices with their timestamp end boundaries.

This function answers the limitation of BUCKETIZE to regular buckets. For instance, BUCKETIZE.CALENDAR can be used with a duration of one month (P1M) or one year (P1Y).

The delta between Unix Epoch and the first timestamp of bucket 0th is called the bucketoffset. The bucketoffset, bucketduration and buckettimezone are stored in the attributes.

Signature

Examples

[ 2019 ] TSELEMENTS-> 'end' STORE NEWGTS 1 2000 <% $end SWAP -1 * ADDDAYS NaN NaN NaN 1 ADDVALUE %> FOR [ SWAP bucketizer.count $end 1 - 'P1M' 0 ] BUCKETIZE.CALENDAR