Groups

A “group” contains a collection of timestreams with consistent sampling. In other words, each timestream in the group has the same number of samples. Each timestream has a name, a data type, and a string describing the units. This metadata for one timestream is called a “field”. The collection of fields used in a group is called the “schema” of the group. A group’s schema is fixed at creation time, but the number of samples may be changed as needed. A group is associated with a parent block. Read and write operations on the data in a group is passed off to the “backend” class in use. A group may also have a dictionary of scalar properties associated with it.

Python

class tidas.Group(*args, **kwargs)

Overloaded function.

  1. __init__(self: tidas._pytidas.Group) -> None
  2. __init__(self: tidas._pytidas.Group, arg0: tidas._pytidas.Schema, arg1: tidas._pytidas.Dictionary, arg2: int) -> None
dictionary(self: tidas._pytidas.Group) → tidas._pytidas.Dictionary
info(self: tidas._pytidas.Group, arg0: std::ostream, arg1: int) → None
range(self: tidas._pytidas.Group) → Tuple[float, float]
read(self: tidas._pytidas.Group, arg0: str, arg1: int, arg2: int) → array
read_times(self: tidas._pytidas.Group, arg0: int, arg1: int) → numpy.ndarray[float64]
resize(self: tidas._pytidas.Group, arg0: int) → None
schema(self: tidas._pytidas.Group) → tidas._pytidas.Schema
size(self: tidas._pytidas.Group) → int
write(self: tidas._pytidas.Group, arg0: str, arg1: int, arg2: buffer) → None
write_times(self: tidas._pytidas.Group, arg0: int, arg1: buffer) → None

C++

class tidas::group

A group represents a collection of timestreams which are sampled consistently (they have the same number of samples).

The list of fields and their types (the schema) is set at construction time. The number of samples in the group may be altered, although this should be done with care since it may be an expensive filesystem operation. A group has an optional dictionary associated with it at construction time. Some public methods are only used internally and are not needed for normal use of the object. These are labelled “internal”.

Public Functions

group()

Default constructor. The backend is set to be memory based.

group(schema const &schm, dict const &d, size_t const &size)

Constructor with specified schema, dictionary, and number of samples.

~group()

Destructor.

group &operator=(group const &other)

Assignment operator.

group(group const &other)

Copy constructor.

group(backend_path const &loc)

(Internal) Load the group from the specified location.

All meta data operations will apply to this location.

group(group const &other, std::string const &filter, backend_path const &loc)

(Internal) Copy from an existing group.

Apply an optional filter to elemetns and relocate to a new location. If a filter is given, a new location must be specified.

void relocate(backend_path const &loc)

(Internal) Change the location of the group.

void sync()

(Internal) Reload metadata from the current location, overwriting the current state in memory.

void flush() const

(Internal) Write metadata to the current location, overwriting the information at that location.

void copy(group const &other, std::string const &filter, backend_path const &loc)

(Internal) Copy with optional selection and relocation.

(Internal) Create a link at the specified location.

void wipe() const

(Internal) Delete the on-disk data and metadata associated with this object.

In-memory metadata is not modified.

backend_path location() const

(Internal) The current location.

dict const &dictionary() const

A (const) reference to the dictionary specified at construction.

schema const &schema_get() const

The fixed schema specified at construction.

index_type size() const

The number of samples currently in the group.

void resize(index_type const &newsize)

Change the number of samples in the group.

Depending on the backend format, this may involve expensive disk operations.

void range(time_type &start, time_type &stop) const

The extrema values of the timestamp field.

void update_range()

Explicitly check timestamps and update group metadata.

template <class T>
void read_field(std::string const &field_name, index_type offset, index_type ndata, T *data) const

Read a range of data from a field.

Store results to the bare memory address specified.

void read_field_astype(std::string const &field_name, index_type offset, index_type ndata, tidas::data_type type, void *data) const

Read a range of data from a field.

Store results to the bare memory address specified. Rather than use templates, this casts the data pointer based on the tidas type.

template <class T>
void write_field(std::string const &field_name, index_type offset, index_type ndata, T const *data)

Write a range of data to a field.

Data is provided at the bare memory address specified.

void write_field_astype(std::string const &field_name, index_type offset, index_type ndata, tidas::data_type type, void const *data)

Write a range of data to a field.

Data is provided at the bare memory address specified. Rather than use templates, this casts the data pointer based on the tidas type.

template <class T>
void read_field(std::string const &field_name, index_type offset, std::vector<T> &data) const

Read a range of data from a field.

Store results in the given vector.

template <class T>
void write_field(std::string const &field_name, index_type offset, std::vector<T> const &data)

Write a range of data to a field.

Data is provided as a vector.

void read_field(std::string const &field_name, index_type offset, std::vector<std::string> &data) const

Read a range of string data from a field.

Store results in in a vector of strings.

void write_field(std::string const &field_name, index_type offset, std::vector<std::string> const &data)

Write a range of string data to a field.

Data is provided as a vector of strings.

void read_times(index_type ndata, time_type *data, index_type offset = 0) const

Read the timestamps for this group.

Data is stored in the bare memory address provided.

void read_times(std::vector<time_type> &data, index_type offset = 0) const

Read the timestamps for this group.

Data is stored in the vector provided.

void write_times(index_type ndata, time_type const *data, index_type offset = 0)

Write the timestamps for this group.

Data is provided at the bare memory address specified.

void write_times(std::vector<time_type> const &data, index_type offset = 0)

Write the timestamps for this group.

Data is provided as a vector.

void info(std::ostream &out, size_t indent) const

Print information to a stream.