arrakis-js
Version:
Arrakis Javascript client library
57 lines (56 loc) • 2.23 kB
TypeScript
import type * as Arrow from "apache-arrow";
/**
* Series block containing timeseries for channels for a given timestamp.
*/
export declare class SeriesBlock {
time_ms: number;
time_ns: number;
date: Date;
data: {
[channel: string]: number[];
};
channels: string[];
/**
* Creates a new SeriesBlock instance.
*
* @param time_ms - The GPS timestamp associated with this data, in miliseconds.
* @param time_ns - The GPS timestamp associated with this data, in nanoseconds.
* @param date - The corresponding UTC Date object
* @param data - Mapping between channels and timeseries.
* @param channels - Channel metadata associated with this data block.
*/
constructor(time_ms: number, time_ns: number, date: Date, data: {
[channel: string]: number[];
}, channels: string[]);
/**
* Creates a SeriesBlock from an Apache Arrow RecordBatch.
*
* This method extracts time-series data from an Arrow batch, converting it
* into a SeriesBlock format. It expects the batch to have a "time" column
* and additional columns for each data channel.
*
* @param batch - Apache Arrow RecordBatch containing the time-series data
* @returns A new SeriesBlock instance created from the batch data
*
* @example
* ```typescript
* const batch = // ... Arrow RecordBatch
* const block = SeriesBlock.fromBatch(batch);
* console.log(block.time_ms); // GPS time in milliseconds
* console.log(block.channels); // Array of channel names
* console.log(block.data['channel1']); // Data array for 'channel1'
* ```
*/
static fromBatch(batch: Arrow.RecordBatch): SeriesBlock;
}
/**
* Join a sequence of SeriesBlock blocks into a single SeriesBlock.
*
* Each block after the first must start when the previous block ends
* (matching timestamps as produced by sequential streaming). All blocks
* must carry the same channel names in {@link SeriesBlock.data}.
*
* @param blocks - The timeseries blocks to concatenate
* @returns The combined timeseries block starting at the first block's time
*/
export declare function concatenate(blocks: SeriesBlock[]): SeriesBlock;