Cfg Class Reference

class comtrade.Cfg(**kwargs)

Parses and stores Comtrade’s CFG data.

Attributes:
analog_channels

Return the analog channels list with complete channel description.

analog_count

Return the number of analog channels.

channels_count

Return the number of channels, total.

digital_channels

Returns the status channels bidimensional values list.

digital_count

Returns the number of status channels.

frequency

Return the measured line frequency in Hertz.

ft

Return the expected DAT file format.

nrates

Return the number of different sample rates within the DAT file.

rec_dev_id

Return the recording device id.

rev_year

Return the COMTRADE revision year.

sample_rates

Return a list with pairs describing the number of samples for a given sample rate.

start_timestamp

Return the recording start time stamp as a datetime object.

station_name

Return the recording device’s station name.

status_channels

Return the status channels list with complete channel description.

status_count

Return the number of status channels.

time_base

Return the time base.

timemult

Return the DAT time multiplier (Default = 1).

timestamp_critical

Returns whether the DAT file must contain non-zero timestamp values.

trigger_timestamp

Return the trigger time stamp as a datetime object.

Methods

load(filepath, **user_kwargs)

Load and read a CFG file contents.

read(cfg_lines)

Read CFG-format data of a FileIO or StringIO object.

property analog_channels: list

Return the analog channels list with complete channel description.

property analog_count: int

Return the number of analog channels.

property channels_count: int

Return the number of channels, total.

property digital_channels: list

Returns the status channels bidimensional values list.

property digital_count: int

Returns the number of status channels.

property frequency: float

Return the measured line frequency in Hertz.

property ft: str

Return the expected DAT file format.

load(filepath, **user_kwargs)

Load and read a CFG file contents.

property nrates: int

Return the number of different sample rates within the DAT file.

read(cfg_lines)

Read CFG-format data of a FileIO or StringIO object.

property rec_dev_id: str

Return the recording device id.

property rev_year: int

Return the COMTRADE revision year.

property sample_rates: list

Return a list with pairs describing the number of samples for a given sample rate.

property start_timestamp: datetime

Return the recording start time stamp as a datetime object.

property station_name: str

Return the recording device’s station name.

property status_channels: list

Return the status channels list with complete channel description.

property status_count: int

Return the number of status channels.

property time_base: float

Return the time base.

property timemult: float

Return the DAT time multiplier (Default = 1).

property timestamp_critical: bool

Returns whether the DAT file must contain non-zero timestamp values.

property trigger_timestamp: datetime

Return the trigger time stamp as a datetime object.

Comtrade Class Reference

class comtrade.Comtrade(**kwargs)

Parses and stores Comtrade data.

Attributes:
analog

Return the analog channel values bidimensional list.

analog_channel_ids

Returns the analog channels name list.

analog_count

Return the number of analog channels.

analog_phases

Returns the analog phase name list.

cfg

Return the underlying CFG class instance.

channels_count

Return the number of channels, total.

digital

Returns the status channels bidimensional values list.

digital_channel_ids

Returns the status channels name list.

digital_count

Returns the number of status channels.

frequency

Return the measured line frequency in Hertz.

ft

Return the expected DAT file format.

hdr

Return the HDR file contents.

inf

Return the INF file contents.

rec_dev_id

Return the recording device id.

rev_year

Return the COMTRADE revision year.

start_timestamp

Return the recording start time stamp as a datetime object.

station_name

Return the recording device’s station name.

status

Return the status channel values bidimensional list.

status_channel_ids

Returns the status channels name list.

status_count

Return the number of status channels.

status_phases

Returns the status phase name list.

time

Return the time values list.

time_base

Return the time base.

total_samples

Return the total number of samples (per channel).

trigger_time

Return relative trigger time in seconds.

trigger_timestamp

Return the trigger time stamp as a datetime object.

Methods

cfg_summary()

Returns the CFG attributes summary string.

load(cfg_file[, dat_file])

Load CFG, DAT, INF, and HDR files.

read(cfg_lines, dat_lines_or_bytes)

Read CFG and DAT files contents.

property analog: list

Return the analog channel values bidimensional list.

property analog_channel_ids: list

Returns the analog channels name list.

property analog_count: int

Return the number of analog channels.

property analog_phases: list

Returns the analog phase name list.

property cfg: Cfg

Return the underlying CFG class instance.

cfg_summary()

Returns the CFG attributes summary string.

property channels_count: int

Return the number of channels, total.

property digital: list

Returns the status channels bidimensional values list.

property digital_channel_ids: list

Returns the status channels name list.

property digital_count: int

Returns the number of status channels.

property frequency: float

Return the measured line frequency in Hertz.

property ft: str

Return the expected DAT file format.

property hdr

Return the HDR file contents.

property inf

Return the INF file contents.

load(cfg_file, dat_file=None, **kwargs) None

Load CFG, DAT, INF, and HDR files. Each must be a FileIO or StringIO object. dat_file, inf_file, and hdr_file are optional (Default: None).

cfg_file is the cfg file path, including its extension. dat_file is optional, and may be set if the DAT file name differs from

the CFG file name.

Keyword arguments: inf_file – optional INF file path (Default = None) hdr_file – optional HDR file path (Default = None)

read(cfg_lines, dat_lines_or_bytes) None

Read CFG and DAT files contents. Expects FileIO or StringIO objects.

property rec_dev_id: str

Return the recording device id.

property rev_year: int

Return the COMTRADE revision year.

property start_timestamp

Return the recording start time stamp as a datetime object.

property station_name: str

Return the recording device’s station name.

property status: list

Return the status channel values bidimensional list.

property status_channel_ids: list

Returns the status channels name list.

property status_count: int

Return the number of status channels.

property status_phases: list

Returns the status phase name list.

property time: list

Return the time values list.

property time_base: float

Return the time base.

property total_samples: int

Return the total number of samples (per channel).

property trigger_time: float

Return relative trigger time in seconds.

property trigger_timestamp

Return the trigger time stamp as a datetime object.

Additional Package Functions

comtrade.fill_with_zeros_to_the_right(number_str: str, width: int)