bw2ui.bin.bw2_browser
Brightway2 database and activity browser. Developed by Bernhard Steubing and Chris Mutel, 2013
- Usage:
bw2-browser bw2-browser <project> bw2-browser <project> <database> bw2-browser <project> <database> <activity-id>
- Options:
-h –help Show this screen. –version Show version.
Attributes
Classes
A command line based Activity Browser for brightway2. |
Functions
|
Get list of most damaging biosphere flows in an LCA, sorted by |
|
|
|
|
|
Search and then filter by criteria. |
Module Contents
- class bw2ui.bin.bw2_browser.ActivityBrowser(completekey='tab', stdin=None, stdout=None)[source]
Bases:
cmd.CmdA command line based Activity Browser for brightway2.
Instantiate a line-oriented interpreter framework.
The optional argument ‘completekey’ is the readline name of a completion key; it defaults to the Tab key. If completekey is not None and the readline module is available, command completion is done automatically. The optional arguments stdin and stdout specify alternate input and output file objects; if not specified, sys.stdin and sys.stdout are used.
- _init(project=None, database=None, activity=None, method=None)[source]
Provide initial data.
Can’t override __init__, because this is an old style class i.e. there is no support for
super.
- _simple_ascii_chart(all_scores=None, all_labels=None)[source]
Fallback simple ASCII bar chart without external dependencies.
- dehydrate_params(params, fields)[source]
Remove keys of each param dictionnary, and only keep fields.
- do_GC(arg)[source]
Do an LCIA of all activities in the temporary list with a fully specified method.
- do_autosave(arg)[source]
Toggle autosave behaviour.
If autosave is on, the current database or activity is written to config.p each time it changes.
- do_backup(target_dir=None)[source]
Backup the current project. Optionally specify a target directory.
- format_exchanges_as_options(es, kind, unit_override=None, show_formulas=False, show_pedigree=False, show_uncertainty=False)[source]
- bw2ui.bin.bw2_browser.bw2_compat_annotated_top_emissions(lca, names=True, **kwargs)[source]
Get list of most damaging biosphere flows in an LCA, sorted by
abs(direct impact). # noqa: E501Returns a list of tuples:
(lca score, inventory amount, activity). Ifnamesis False, they returns the process key as the last element. # noqa: E501
- bw2ui.bin.bw2_browser.search_bw2(search_criterion, criterion_value, database, needle, search_limit)[source]
Search and then filter by criteria.
- bw2ui.bin.bw2_browser.HELP_TEXT = Multiline-String[source]
Show Value
""" This is a simple way to browse databases and activities in Brightway2. The following commands are available: Basic commands: ?: Print this help screen. quit, q: Exit the activity browser. number: Go to option number when a list of options is present. l: List current options. n: Go to next page in paged options. p: Go to previous page in paged options. p number: Go to page number in paged options. h: List history of databases and activities viewed. wh: Write history to a text file. autosave: Toggle autosave behaviour on and off. Working with projects: lpj: List available projects. backup [directory]: Backup the current project. Optionally specify a target directory. If no directory is specified, the backup will be created in the projects directory with a timestamp. restore <archive> [options]: Restore a project from an archive. Supported options: --project NAME, --overwrite. Working with databases: ldb: List available databases. db name: Go to database name. No quotes needed. s [string]: Search activity names in current database with string. Without string the search provides no results. s -loc {LOCATION} [string]: Search activity names in current database with string and location LOCATION. s -cat {CAT::SUBCAT::SUBSUBCAT} [string]: Search activity names in current database with string and category CAT, SUBCAT, SUBCAT [useful for biosphere]. s -rp {REFERENCE PRODUCT} [string]: Search activities in current database that have reference product and optionnaly match string in search. Working with activities: a id: Go to activity id in current database. Complex ids in quotes. aa: List all activities in current database. aa name sorts the activities by name. lprods: List product activities only (product and process_with_reference_product). i: Info on current activity. ii: Extended Info on current activity. r: Choose a random activity from current database. u: List upstream activities (inputs for the current activity). up: List upstream activities with pedigree info if avail (inputs for the current activity). uu: List upstream activities with formula info if avail. un: display uncertainty information of upstream activitities if avail. d: List downstream activities (activities which consume current activity). b: List biosphere flows for the current activity. pe: List production exchanges for current activity. pei: show the information of the production exchange of the current activity. cfs: Show characterization factors for current activity and current method. G: if a method and activity are selected, do an lcia of the activity. ta: if an lcia of the activity has been done, list top activities. te: if an lcia of the activity has been done, list top emissions. ca: do a contribution analysis of an activity with a method. sc: print recursive supply chain of an activity. Working with methods: lm: List methods. mi: Show method metadata. (must select method/category/subcategory first) Working with parameters: lpam: List all parameters (Project, Database and Activity) showing only basic columns (data). lpam [-f]: List all parameters showing all columns (data) of each parameter. lpam [-f] -g {YY}: List parameters for a specific group. Use db or specific data. add as first option -f to show all columns. lpamg: show parameter groups ap [-f]: If an activity is selected, show activity parameters dp [-f]: if a database is selected show database parameters pp [-f]: If a project is selected show project parameters fp : Find parameters (Project, Database or Activity) by name sp : search a parameter (accepts wildcards) Misc: tsv: [filename] export latest table to tsv file (e.g.: results or cfs) GC: Start group contribution mode for comparing multiple activities. add: Add current activity to the list for group contribution/compare analysis. list: List all activities added for group contribution/compare analysis. clear: Clear (empty) the list of added activities for group contribution/compare. GCH: Show the results table from the last group contribution/compare analysis. """