Skip to content

Config

combine_dataset_config(config, dataset=None, meter=None, point=None, date=None)

Select configuration parameters for given dataset identifiers

Parameters:

Name Type Description Default
config dict

Complete configuration parameters.

required
dataset str

Dataset identifier name.

None
meter str

Meter identifier.

None
point str

Point identifier.

None
date str

Measurement date.

None

Returns:

Type Description
dict

Configuration parameters specific to this dataset.

read_config(path)

Read a YAML config file

Parameters:

Name Type Description Default
path str | Path

Path to a YAML config file.

required

Returns:

Type Description
dict

Dictionary of configuration parameters.

select_date_config(config, date)

Select configuration parameters for a measurement date

Expects a dictionary of configuration parameters (config) that apply generally or are time-dependent. Time-dependent parameters should be grouped in a sub-dictionary with a key that denotes the starting date (identified by is_date()).

For example:

{
    'parameter1': 1,
    'parameter2': 2,
    '2020-01-01': {
        'parameter1: 2,
    },
    datetime.date(2021, 1, 1): {
        'parameter1: 3,
    },
}

Returns a merged dictionary of parameters that apply for the given date.

Parameters:

Name Type Description Default
config dict

Configuration parameters.

required
date str | Timestamp

Measurement date.

required

Returns:

Type Description
dict

Dictionary of configuration parameters.

Examples:

>>> select_date_config({'x': 1, 'y': 2, '2020-01-01': {'x': 2}}, '2020-01-02')
{'x': 2, 'y': 2}