Time series return types

When a routine returns a time series, calendar information is preserved and, if possible, threshold and container information is preserved.

Some functions that return a TimeSeries subtype require that the return value be cast to a particular time series type. For functions like Clip, WithinC, and WithinR, the return type is always the same as the type of the argument time series, and no cast is required.

However, for other functions, such as AggregateBy, Apply, and Union, the type of the resulting time series is not necessarily the same as a time series argument. These functions require that their return types be cast to particular time series types.

If a time series returned by one of these functions cannot use the container of the original time series and a container name is not specified, the resulting time series is stored in a container associated with the matching TimeSeries subtype and regularity. If no matching container exists, a new container is created.