REGISTER NOW: DdS Autumn School! 🇨🇭 Grosshöchstetten (Switzerland) 🗓️ 6.-11. October 2024

bw2io.extractors.ecospold1#

Module Contents#

Classes#

Ecospold1DataExtractor

Functions#

robust_nested_attribute(→ Any)

Try to get nested attribute, and fail gracefully.

robust_text(→ str | None)

Just because the spec says it must be there doesn't mean it will be.

class bw2io.extractors.ecospold1.Ecospold1DataExtractor[source]#
classmethod extract(path: str | pathlib.Path | io.StringIO, db_name: str, use_mp: bool = True)[source]#

Extract data from ecospold1 files.

Parameters#

pathstr

Path to the directory containing the ecospold1 files or path to a single file.

db_namestr

Name of the database.

use_mpbool, optional

If True, uses multiprocessing to parallelize extraction of data from multiple files, by default True.

Returns#

list

List of dictionaries containing data from the ecospold1 files.

classmethod process_allocation(exc, dataset)[source]#
classmethod process_dataset(dataset: pyecospold.model_v1.Dataset, filename: str | pathlib.Path | io.StringIO, db_name: str)[source]#
classmethod process_exchange(exc, dataset)[source]#

Process exchange.

Input groups are:

  1. Materials/fuels

  2. Electricity/Heat

  3. Services

  4. FromNature

  5. FromTechnosphere

Output groups are:

  1. Reference product

  2. Include avoided product system

  3. Allocated byproduct

  4. Waste to treatment

  5. ToNature

A single-output process will have one output group 0; A MO process will have multiple output group 2s. Output groups 1 and 3 are not used in ecoinvent.

classmethod process_exchanges(dataset)[source]#
classmethod process_file(filepath: str | pathlib.Path | io.StringIO, db_name: str)[source]#

Process a single ecospold1 file.

Parameters#

filepathstr

Path to the ecospold1 file.

db_namestr

Name of the database.

Returns#

list

List of dictionaries containing data from the ecospold1 file.

classmethod process_uncertainty_fields(exc, data)[source]#
bw2io.extractors.ecospold1.robust_nested_attribute(root: lxml.etree.ElementBase, attr1: str, attr2: str) Any[source]#

Try to get nested attribute, and fail gracefully.

bw2io.extractors.ecospold1.robust_text(root: lxml.etree.ElementBase, attribute: str) str | None[source]#

Just because the spec says it must be there doesn’t mean it will be.