bw2simple: Simple proxies for Brightway2 objects

This is a small package that makes it easier to interact with Brightway2 objects in the command line, so you no longer have to worry about process keys like ("foo", "b68fe2e7f871f48970e958f476fbaeea").

See the introduction video on youtube.

So far, there are proxies for activities and exchanges:

Activity simple proxy

class bw2simple.activity.Activity(key)

Simple proxy for an activity dataset. Makes manipulation and use in command line more convenient.

Warning

This proxy is read only! To save changes to a dataset, you will need to work with the raw database data.

Instantiate a activity proxy with its key, e.g. ("foo", "bar"):

activity = Activity(("foo", "bar"))

Properties:

See also the descriptions of each method below.

lca(method=None, amount=1.0)

Shortcut to construct an LCA object for this activity.

open_in_webbrowser()

Open this activity in the web UI.

Requires bw2-web to be running.

Exchange simple proxy

class bw2simple.exchange.Exchange(exc, activity)

Simple proxy for an exchange between activity datasets. Makes manipulation and use in command line more convenient.

Warning

This proxy is read only! To save changes to a dataset, you will need to work with the raw database data.

Usually these proxies are created by the Activity simple proxy, but you can instantiate one with the dictionary of exchange data and an Activity proxy of the consuming activity:

exchange = Exchange({"my exchange data": "goes here"}, my_activity_proxy)

Properties:

random_sample(n=100)

Draw a random sample from this exchange.

Exchanges: list of Exchange proxies

class bw2simple.exchange.Exchanges(exchanges, activity=None, as_exchanges=False)

Proxy for a list of Exchange objects.