smartgrid.agents.data_conversion.DataOpenEIConversion

class smartgrid.agents.data_conversion.DataOpenEIConversion[source]

Bases: DataConversion

DataConversion specialized for data coming from the OpenEI dataset.

Data that were extracted from the OpenEI dataset have been transformed as NPZ files for easier and faster loading from Python. They should all have the same structure:

  • needs: A NumPy array describing the quantity of energy needed each step.

  • action_limit: The upper bound of the agent’s action.

  • max_storage: The capacity of the agent’s personal storage.

Note that OpenEI-based profiles do not contain production or comfort: we must generate them ourselves. As such, the load() method requires an additional comfort_fn argument (keyworded, e.g., comfort_fn=...).

__init__()

Methods

__init__()

load(name, data_path[, comfort_fn])

Load a profile from an OpenEI-based data file.

Attributes

expected_keys

Keys that are expected in the NpzFile loaded from the data file.

profiles

Profiles already loaded by the DataConversion, to speed up next calls.

_get_ndarray_single_value(array: ndarray)[source]

Internal method to get the single value of a 0d or 1d ndarray.

expected_keys = ['needs', 'action_limit', 'max_storage']

Keys that are expected in the NpzFile loaded from the data file.

load(name, data_path, comfort_fn=None) AgentProfile[source]

Load a profile from an OpenEI-based data file.

These data files can be found in the data/openei directory.

Parameters:
  • name – The desired profile name. This can be seen as the profile’s ID, as it will be used to later retrieve it from the profiles dict.

  • data_path – The path to the data file from which the profile should be loaded. This path must exist and be readable.

  • comfort_fn – The comfort function that should be used. See comfort for details on comfort functions.

Returns:

The loaded AgentProfile for direct use.

profiles: Dict[str, AgentProfile]

Profiles already loaded by the DataConversion, to speed up next calls.