bw2io.importers.base#

Module Contents#

Classes#

ImportBase

Base class for format-specific importers.

class bw2io.importers.base.ImportBase(*args, **kwargs)[source]#

Bases: object

Base class for format-specific importers.

Defines workflow for applying strategies.

property unlinked[source]#

Iterate through unique unlinked exchanges.

Uniqueness is determined by activity_hash.

_migrate_datasets(migration_name)[source]#
_migrate_exchanges(migration_name)[source]#
apply_strategies(strategies=None, verbose=True)[source]#

Apply a list of strategies.

Uses the default list self.strategies if strategies is None.

Parameters

*strategies* (list, optional) – List of strategies to apply. Defaults to self.strategies.

Returns

Nothings, but modifies self.data, and adds each strategy to self.applied_strategies.

apply_strategy(strategy, verbose=True)[source]#

Apply strategy transform to self.data.

Adds strategy name to self.applied_strategies. If StrategyError is raised, print error message, but don’t raise error.

Note

Strategies should not partially modify data before raising StrategyError.

Parameters

*strategy* (callable) –

Returns

Nothing, but modifies self.data, and strategy to self.applied_strategies.

write_unlinked(name)[source]#

Write all data to an UnlikedData data store (not a Database!)