pigeonpy.data.epddata.epddatamanager module¶
Defines the EpdDataManager class as registry and manager for all data sources.
- class pigeonpy.data.epddata.epddatamanager.EpdDataManager(dataset_template)[source]¶
Bases:
objectClass to handle EPD data and their sources.
The EpdDataManager contains a dictionary to register multiple EPD sources, a method to load the EPD data from a source into an EpdDataset object, and it caches already loaded datasets for the case of multiple usages of one dataset.
- sources¶
Contains the registered sources as values with a user defined key
- Type:
dict
- dataset_template¶
A subclass of EpdDataset itself (not an instance) that serves as a template for creating instances of the given class to load the indicator data of an EPD dataset into the data array of the class instance.
- Type:
EpdDataset
- _fetched_datasets¶
Caches the data array and name of an already loaded dataset with its epd_id as key.
- Type:
dict
- register_source(source_key, source)[source]¶
Registers a source instance into the sources dictionary with a given key and calls its load() method.
- load_epd(epd_id, scenario=None, epd_dataset=None, source_key=None)[source]¶
Either loads a dataset from the cached datasets or calls the method of one of the EPD sources in the sources dictionary to load the environmental indicator data into an EpdDataset instance. If an EPD is loaded for the first time, it is saved in the dataset cache dictionary (_fetched_datasets).
- Parameters:
epd_id (str) – epd_id of the EPD dataset to be loaded
scenario (str) – Scenario name to identify the scenario that should be loaded into the dataset object; can be None or nan
epd_dataset (EpdDataset) – Instance of EpdDataset. If None, then an instance is created using the associated method and dataset_template attribute.
source_key (str) – If specified (and found in sources) uses the source indicated by the source_key to load the EPD data from. If no source_key is given, it searches the sources for a source that contains a dataset with the given epd_id.
- Returns:
epd_dataset – The returned dataset is filled with data and information of the EPD indicated by the epd_id.
- Return type:
EpdDataset
- Raises:
ValueError : – When a source_key is given, which is not present in the sources dictionary.
Exception : – A dataset for the given epd_id could not be found/loaded from a source present in the sources dictionary.