pigeonpy.utility module¶
Provides functions for linear interpolating two datasets and for fetching soda4Lca database exports.
- pigeonpy.utility.linear_interpolate(dataset1, dataset2, steps, return_datasets=True)[source]¶
This function interpolates linearly between the values of two EPD datasets. One EPD dataset is generated per step between dataset1 and dataset2.
- Parameters:
dataset1 (EpdDataset) – First dataset for interpolation
dataset2 (EpdDataset) – Second dataset for interpolation
steps (int) – Number of steps that are interpolated
return_datasets (boolean) – If True, datasets are returned instead of numpy arrays
- Returns:
interpolated_arrays – Contains the list of interpolated data/ numpy arrays
- Return type:
list
- pigeonpy.utility.get_soda4lca_node_datastock(root, export_format='csv', shortname_identifier=None, datastock_uuid=None)[source]¶
Function that requests the download for a specific datastock of a soda4LCA node specified by the root URL. If no datastock_uuid or shortname_identifier is specified (None), the latest available datastock is requested. Alternative format for download is “ZIP”, which can get pretty large (Epd International ~18GB zip file). Note that CSV export is not available for every soda4LCA node.
The download of larger database exports may take time (EPD Norway for instance can take several minutes to download). If one wishes to track the download, the _download_file() function below contains commented out code implementing a progress bar for the download using the tqdm library.
- Parameters:
root (str) – URL for the soda4LCA API entry point; Including resource, e.g. ‘https://oekobaudat.de/OEKOBAU.DAT/resource’
export_format (str) – Either “csv” (default) or “zip”
shortname_identifier (str) – Used to select a datastock at the associated endpoint, e.g. https://oekobaudat.de/OEKOBAU.DAT/resource/datastocks?format=JSON To view available datastocks, give arbitrary string as argument.
datastock_uuid (str or None) – Alternative identifier to select a datastock for download. To view available datastocks, give arbitrary string as argument.
- Returns:
filepath – The path to the downloaded database file in the chosen export_format
- Return type:
Path