├── .cache └── v │ └── cache │ └── lastfailed ├── .coverage ├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── MANIFEST.in ├── README.md ├── appveyor.yml ├── ci ├── appveyor │ └── install_miniconda.ps1 └── travis │ └── recipe │ └── meta.yaml ├── codemeta.json ├── conftest.py ├── dist ├── lcopt-0.2.2.tar.gz ├── lcopt-0.3.0.tar.gz └── lcopt-0.3.1.tar.gz ├── docs ├── 0_introduction.rst ├── 1_installation.rst ├── 2_Getting_Started.rst ├── 3_use.rst ├── 4_technical.rst ├── 5_contact.rst ├── 6_cite.rst ├── Makefile ├── _static │ ├── Lcopt_runthrough.mp4 │ └── runthrough_title.jpg ├── assets │ ├── hotspot_chart_tea_sm.png │ ├── lcopt_dev_settings.jpg │ ├── lcopt_launcher_dialog.jpg │ ├── tea_flow_chart.jpg │ └── tree_sm.png ├── conf.py ├── index.rst └── make.bat ├── lcopt ├── __init__.py ├── analysis.py ├── assets │ ├── biosphere3.pickle │ ├── ecoinvent3_3.pickle │ ├── ecoinvent_example.lcopt │ ├── forwast.pickle │ ├── forwast_example.lcopt │ ├── lcopt_icon.ico │ └── locations.json ├── bin │ ├── lcopt_bw2_setup.py │ ├── lcopt_bw2_setup_forwast.py │ ├── lcopt_launcher.py │ └── lcopt_settings.py ├── bw2_export.py ├── bw2_import.py ├── bw2_utils.py ├── constants.py ├── data_store.py ├── export_disclosure.py ├── export_view.py ├── interact.py ├── io.py ├── mass_balance.py ├── model.py ├── multi_tagged.py ├── parameters.py ├── settings.py ├── settings_gui.py ├── static │ ├── THIS IS SYMLINKED TO THE NOTEBOOK TEST PATH │ ├── css │ │ ├── analysis.css │ │ ├── cdn_cache │ │ │ ├── Muli-Regular.ttf │ │ │ ├── bootstrap-dialog.min.css │ │ │ ├── bootstrap-select.min.css │ │ │ ├── bootstrap.min.css │ │ │ ├── font-awesome.min.css │ │ │ ├── images │ │ │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ │ │ ├── ui-icons_222222_256x240.png │ │ │ │ ├── ui-icons_555555_256x240.png │ │ │ │ ├── ui-icons_777620_256x240.png │ │ │ │ ├── ui-icons_777777_256x240.png │ │ │ │ ├── ui-icons_cc0000_256x240.png │ │ │ │ └── ui-icons_ffffff_256x240.png │ │ │ ├── jquery-ui.css │ │ │ ├── material-icons.css │ │ │ ├── material-icons.woff2 │ │ │ └── selectize.css │ │ ├── function_box.css │ │ ├── mass_flow.css │ │ ├── methods_box.css │ │ ├── parameter_table.css │ │ ├── sandbox.css │ │ ├── search_table.css │ │ ├── selectize_location.css │ │ ├── status.css │ │ ├── style.css │ │ ├── toast.css │ │ ├── treetest.css │ │ ├── typeahead.css │ │ └── waterfall.css │ ├── img │ │ ├── lcoptIcon2.gif │ │ ├── legend.svg │ │ └── loading.svg │ └── js │ │ ├── analysis.js │ │ ├── cdn_cache │ │ ├── bootstrap-dialog.min.js │ │ ├── bootstrap-select.js │ │ ├── bootstrap.min.js │ │ ├── d3-legend.js │ │ ├── d3-legend.min.js │ │ ├── d3-textwrap.JJ.js │ │ ├── d3-tip.js │ │ ├── d3.min.js │ │ ├── d3.v4.min.js │ │ ├── jquery-ui.min.js │ │ ├── jquery.min.js │ │ ├── jsplumb.min.js │ │ ├── sankey.js │ │ ├── selectize-plugin-clear.js │ │ ├── selectize.js │ │ ├── selectize_duplicates_JJ.js │ │ └── typeahead.bundle.js │ │ ├── comparison_bar.js │ │ ├── export_chart.js │ │ ├── function_box.js │ │ ├── hotspot.js │ │ ├── location_selectize.js │ │ ├── mass_flow.js │ │ ├── md5.js │ │ ├── methods_box.js │ │ ├── pie2.js │ │ ├── result_table.js │ │ ├── sandbox.js │ │ ├── sandbox_functions.js │ │ ├── search_table.js │ │ ├── stacked_bar.js │ │ ├── stacked_bar_negative.js │ │ ├── status.js │ │ ├── status_update.js │ │ ├── sunburst.js │ │ ├── table-edit.js │ │ ├── toast.js │ │ ├── treetest2.js │ │ └── waterfall.js ├── templates │ ├── 404.html │ ├── 500.html │ ├── Header.csv │ ├── Process.csv │ ├── ProjectParameters.csv │ ├── Quantities.csv │ ├── SimaPro.csv │ ├── Units.csv │ ├── analysis.html │ ├── analysis_fail.html │ ├── analysis_preload.html │ ├── base.html │ ├── create_functions.html │ ├── export.csv │ ├── lcopt_settings.html │ ├── mass_flow.html │ ├── parameter_set_table_sorted.html │ ├── sandbox.html │ ├── settings.html │ ├── settings_cancel.html │ ├── settings_saved.html │ ├── shutdown.html │ ├── status.html │ └── testbed.html └── utils.py ├── paper.bib ├── paper.md ├── recipe └── meta.yaml ├── rtd-requirements.txt ├── setup.cfg ├── setup.py ├── tests ├── assets │ ├── Sample_Db.1499a346648778a2d15b5c7e7e9d82d2.bw2package │ ├── Test_model.lcopt │ ├── Test_model_b.lcopt │ └── datasets │ │ ├── af38c61f-49da-4b61-830a-7675af41063e_c4842286-21e6-4142-bc35-f2c36f1d68a2.spold │ │ ├── e605e0aa-8340-4083-93ff-1069a4b08026_759b89bd-3aa6-42ad-b767-5bb9ef5d331d.spold │ │ └── e9b08494-3dba-4b12-99d2-b676e92f49a4_6326adcd-063f-4c42-ae99-973bd21cbb20.spold ├── fixtures.py ├── modelName.lcopt ├── test_exports.py ├── test_import.py ├── test_interact.py ├── test_model.py ├── test_settings.py └── tests.html └── travis-requirements.txt /.cache/v/cache/lastfailed: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.ipynb 2 | /*.lcopt 3 | /*.lcoptview 4 | /*.csv 5 | *.xlsx 6 | /static/ 7 | /templates/ 8 | *.pyc 9 | /htmlcov/* 10 | report.html 11 | generate 12 | dist 13 | build 14 | lcopt.egg-info/ 15 | *.egg-info/ 16 | /docs/_build/* 17 | .coverage* 18 | /tests/Test_model* 19 | .pytest_cache 20 | /tests/*.csv 21 | /tests/htmlcov/ 22 | /lcopt/__pycache__/ 23 | /lcopt/assets/Ecoinvent* 24 | /lcopt/assets/lcopt_config.yml 25 | __pycache__/ 26 | tests/__pycache__/ 27 | video_transcript.txt 28 | 29 | .idea/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "3.6" 4 | # command to install dependencies 5 | install: 6 | - sudo apt-get update 7 | - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh 8 | - bash miniconda.sh -b -p $HOME/miniconda 9 | - export PATH="$HOME/miniconda/bin:$PATH" 10 | - hash -r 11 | - conda config --set always_yes yes --set changeps1 no 12 | - conda update -q conda 13 | - conda install conda-build 14 | # Useful for debugging any issues with conda 15 | - conda info -a 16 | 17 | # conda channels 18 | - conda config --append channels conda-forge 19 | - conda config --append channels cmutel 20 | - conda config --append channels haasad 21 | - conda config --append channels pjamesjoyce 22 | 23 | # conda build 24 | - if [ "$TRAVIS_OS_NAME" == "linux" ]; then 25 | echo $(date '+%Y%m%d%H%M'); 26 | sed "s/ number:\ 0/ number:\ $(date '+%Y%m%d%H%M')/g" ./ci/travis/recipe/meta.yaml > /tmp/meta.yaml; 27 | mv /tmp/meta.yaml ./ci/travis/recipe/meta.yaml; 28 | fi 29 | - conda build ./ci/travis/recipe 30 | 31 | # Create environment 32 | - conda create -q -n test python=$TRAVIS_PYTHON_VERSION 33 | - source activate test 34 | - conda install -q --use-local lcopt-dev 35 | - pip install -r travis-requirements.txt 36 | 37 | # command to run tests 38 | script: cd tests; pytest --cov=lcopt 39 | 40 | after_success: 41 | - if [ "$TRAVIS_OS_NAME" == "linux" ]; then 42 | coveralls; 43 | echo "$TRAVIS_BRANCH" 44 | echo "$TRAVIS_PULL_REQUEST" 45 | echo $TRAVIS_BRANCH 46 | echo $TRAVIS_PULL_REQUEST 47 | 48 | if [ "$TRAVIS_BRANCH" = "development" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then 49 | conda install anaconda-client; 50 | cp /home/travis/miniconda/conda-bld/noarch/*.tar.bz2 .; 51 | anaconda -t $CONDA_TOKEN upload --force *.tar.bz2; 52 | echo "uploaded to conda channel"; 53 | else 54 | echo "no upload because not development branch"; 55 | fi 56 | else 57 | echo "no upload from osx"; 58 | fi 59 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2017 P. James Joyce 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | # Include the license file 2 | include LICENSE.txt 3 | include README.md 4 | recursive-include lcopt/assets * 5 | recursive-include lcopt/templates * 6 | recursive-include lcopt/static * 7 | recursive-include lcopt/bin * 8 | 9 | # Include the data files if there are any 10 | # recursive-include data * 11 | 12 | # If using Python 2.6 or less, then have to include package data, even though 13 | # it's already declared in setup.py 14 | # include sample/*.dat -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # modified from https://github.com/haasad/PyPardisoProject 2 | build: false 3 | 4 | environment: 5 | matrix: 6 | - JOB: "Python 3.6, 64bit" 7 | PYTHON: "C:\\Python36_64" 8 | PYTHON_VERSION: "3.6" 9 | PYTHON_ARCH: "64" 10 | CONDA_PY: "36" 11 | CONDA_ENV_PY: "3.6" 12 | 13 | install: 14 | - "powershell .\\ci\\appveyor\\install_miniconda.ps1" 15 | - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" 16 | - "conda update conda" 17 | - "conda config --set always_yes yes --set changeps1 no" 18 | - "conda config --append channels conda-forge" 19 | - "conda config --append channels cmutel" 20 | - "conda config --append channels haasad" 21 | - "conda config --append channels pjamesjoyce" 22 | - "conda build .\\ci\\travis\\recipe" 23 | - "conda create -n test_env python=%CONDA_ENV_PY%" 24 | - "activate test_env" 25 | - "conda install --use-local lcopt-dev" 26 | - 'conda install -q "pytest<3.5"' 27 | 28 | test_script: 29 | - "py.test" -------------------------------------------------------------------------------- /ci/appveyor/install_miniconda.ps1: -------------------------------------------------------------------------------- 1 | # Sample script to install Miniconda under Windows 2 | # Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner, Robert McGibbon 3 | # License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ 4 | 5 | $MINICONDA_URL = "http://repo.continuum.io/miniconda/" 6 | 7 | 8 | function DownloadMiniconda ($python_version, $platform_suffix) { 9 | $webclient = New-Object System.Net.WebClient 10 | if ($python_version -match "3.6") { 11 | $filename = "Miniconda3-latest-Windows-" + $platform_suffix + ".exe" 12 | } else { 13 | $filename = "Miniconda-latest-Windows-" + $platform_suffix + ".exe" 14 | } 15 | $url = $MINICONDA_URL + $filename 16 | 17 | $basedir = $pwd.Path + "\" 18 | $filepath = $basedir + $filename 19 | if (Test-Path $filename) { 20 | Write-Host "Reusing" $filepath 21 | return $filepath 22 | } 23 | 24 | # Download and retry up to 3 times in case of network transient errors. 25 | Write-Host "Downloading" $filename "from" $url 26 | $retry_attempts = 2 27 | for($i=0; $i -lt $retry_attempts; $i++){ 28 | try { 29 | $webclient.DownloadFile($url, $filepath) 30 | break 31 | } 32 | Catch [Exception]{ 33 | Start-Sleep 1 34 | } 35 | } 36 | if (Test-Path $filepath) { 37 | Write-Host "File saved at" $filepath 38 | } else { 39 | # Retry once to get the error message if any at the last try 40 | $webclient.DownloadFile($url, $filepath) 41 | } 42 | return $filepath 43 | } 44 | 45 | 46 | function InstallMiniconda ($python_version, $architecture, $python_home) { 47 | Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home 48 | if (Test-Path $python_home) { 49 | Write-Host $python_home "already exists, skipping." 50 | return $false 51 | } 52 | if ($architecture -match "32") { 53 | $platform_suffix = "x86" 54 | } else { 55 | $platform_suffix = "x86_64" 56 | } 57 | 58 | $filepath = DownloadMiniconda $python_version $platform_suffix 59 | Write-Host "Installing" $filepath "to" $python_home 60 | $install_log = $python_home + ".log" 61 | $args = "/S /D=$python_home" 62 | Write-Host $filepath $args 63 | Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru 64 | if (Test-Path $python_home) { 65 | Write-Host "Python $python_version ($architecture) installation complete" 66 | } else { 67 | Write-Host "Failed to install Python in $python_home" 68 | Get-Content -Path $install_log 69 | Exit 1 70 | } 71 | } 72 | 73 | 74 | function InstallCondaPackages ($python_home, $spec) { 75 | $conda_path = $python_home + "\Scripts\conda.exe" 76 | $args = "install --yes " + $spec 77 | Write-Host ("conda " + $args) 78 | Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru 79 | } 80 | 81 | function UpdateConda ($python_home) { 82 | $conda_path = $python_home + "\Scripts\conda.exe" 83 | Write-Host "Updating conda..." 84 | $args = "update --yes conda" 85 | Write-Host $conda_path $args 86 | Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru 87 | } 88 | 89 | 90 | function main () { 91 | InstallMiniconda $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON 92 | UpdateConda $env:PYTHON 93 | InstallCondaPackages $env:PYTHON "conda-build anaconda-client" 94 | } 95 | 96 | main -------------------------------------------------------------------------------- /ci/travis/recipe/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set name = "lcopt-dev" %} 2 | {% set version = "0.4.3.dev" %} 3 | 4 | package: 5 | name: '{{ name|lower }}' 6 | version: '{{ version }}' 7 | 8 | source: 9 | path: ../../.. 10 | 11 | build: 12 | noarch: python 13 | number: 0 14 | script: python setup.py install --single-version-externally-managed --record=record.txt 15 | entry_points: 16 | - lcopt-launcher = lcopt.bin.lcopt_launcher:main 17 | - lcopt-bw2-setup = lcopt.bin.lcopt_bw2_setup:main 18 | - lcopt-bw2-setup-forwast = lcopt.bin.lcopt_bw2_setup_forwast:main 19 | - lcopt-settings = lcopt.bin.lcopt_settings:main 20 | 21 | requirements: 22 | build: 23 | - python 24 | - setuptools 25 | - python 26 | - bw2data >=3.4.2 27 | - brightway2 >=2.1.2 28 | - pandas 29 | - pyyaml 30 | - eidl 31 | - flask 32 | - pywin32 # [win] 33 | - bw2io >=0.7.1 34 | - numpy x.x 35 | 36 | run: 37 | - python 38 | - bw2data >=3.4.2 39 | - brightway2 >=2.1.2 40 | - pandas 41 | - pyyaml 42 | - eidl 43 | - flask 44 | - pywin32 # [win] 45 | - bw2io >=0.7.1 46 | - numpy x.x 47 | 48 | about: 49 | home: https://github.com/pjamesjoyce/lcopt/ 50 | license: BSD 3-Clause 51 | license_family: BSD 52 | license_file: LICENSE.txt 53 | summary: 'An interactive tool for creating fully parameterised Life Cycle Assessment (LCA) foreground models - DEVELOPMENT VERSION' 54 | description: '# lcopt 55 | 56 | An interactive tool for creating fully parameterised Life Cycle Assessment (LCA) foreground models 57 | 58 | 59 | [![Build Status](https://travis-ci.org/pjamesjoyce/lcopt.svg?branch=master)](https://travis-ci.org/pjamesjoyce/lcopt) 60 | 61 | 62 | [![Coverage Status](https://coveralls.io/repos/github/pjamesjoyce/lcopt/badge.svg?branch=master)](https://coveralls.io/github/pjamesjoyce/lcopt?branch=master) 63 | 64 | 65 | Lcopt is a python module for creating fully parameterised LCA foreground models using a Flask based interactive GUI developed by [James Joyce](https://pjamesjoyce.github.io/) 66 | 67 | It integrates with SimaPro and BrightWay2 68 | 69 | 70 | Online documentation, including full installation instructions, is available [here](http://lcopt.readthedocs.io)' 71 | doc_url: 'http://lcopt.readthedocs.io/en/latest/index.html' 72 | dev_url: 'https://github.com/pjamesjoyce/lcopt' 73 | -------------------------------------------------------------------------------- /codemeta.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld", 3 | "@type": "Code", 4 | "author": [ 5 | { 6 | "@id": "http://orcid.org/0000-0002-9560-3132", 7 | "@type": "Person", 8 | "email": "pjamesjoyce@gmail.com", 9 | "name": "James Joyce", 10 | "affiliation": "KTH Royal Institute of Technology" 11 | } 12 | ], 13 | "identifier": "", 14 | "codeRepository": "https://github.com/pjamesjoyce/lcopt/", 15 | "datePublished": "2017-07-24", 16 | "dateModified": "2017-07-24", 17 | "dateCreated": "2017-07-24", 18 | "description": "An interactive Life Cycle options appraisal tool", 19 | "keywords": "Life cycle assessment, foreground model, LCA", 20 | "license": "BSD 3-Clause", 21 | "title": "lcopt", 22 | "version": "v0.4.0" 23 | } -------------------------------------------------------------------------------- /conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | import os 3 | import brightway2 as bw2 4 | from lcopt.data_store import storage 5 | import yaml 6 | from copy import deepcopy 7 | 8 | from lcopt.constants import DEFAULT_BIOSPHERE_PROJECT 9 | from lcopt.utils import bw2_project_exists 10 | 11 | TEST_MODEL_NAME = "Test_model" 12 | 13 | #print(storage.config_file) 14 | 15 | #with open(storage.config_file, 'r') as f: 16 | # ORIGINAL_CONFIG = yaml.load(f) 17 | 18 | #print(ORIGINAL_CONFIG) 19 | 20 | ORIGINAL_CONFIG = deepcopy(storage.config) 21 | 22 | FULL_SETUP = True 23 | 24 | @pytest.fixture(scope="session", autouse=True) 25 | def setup_fixtures(request): 26 | 27 | print('RUNNING SETUP FIXTURE') 28 | 29 | storage.config['ecoinvent']['version'] = '3.3' 30 | storage.config['ecoinvent']['system_model'] = 'cutoff' 31 | storage.config['model_storage']['project'] = 'unique' 32 | storage.config['model_storage']['location'] = 'currdir' 33 | 34 | 35 | 36 | if FULL_SETUP: 37 | bw2.projects.purge_deleted_directories() 38 | if TEST_MODEL_NAME in bw2.projects: 39 | bw2.projects.delete_project(name=TEST_MODEL_NAME, delete_dir=True) 40 | 41 | if bw2_project_exists(DEFAULT_BIOSPHERE_PROJECT): 42 | bw2.projects.set_current(DEFAULT_BIOSPHERE_PROJECT) 43 | bw2.projects.copy_project(TEST_MODEL_NAME, switch=True) 44 | else: 45 | bw2.projects.set_current(TEST_MODEL_NAME) 46 | bw2.bw2setup() 47 | 48 | 49 | script_path = os.path.dirname(os.path.realpath(__file__)) 50 | ecospold_folder = os.path.join("tests", "assets", "datasets") 51 | ecospold_path = os.path.join(script_path, ecospold_folder) 52 | print(ecospold_path) 53 | 54 | ei = bw2.SingleOutputEcospold2Importer(ecospold_path, "Ecoinvent3_3_cutoff") 55 | ei.apply_strategies() 56 | ei.statistics() 57 | ei.write_database() 58 | 59 | bw2.projects.set_current('default') 60 | 61 | def teardown_fixtures(): 62 | print('TEAR IT DOWN!!') 63 | 64 | print('cleaning up brightway') 65 | 66 | bw2.projects.set_current('default') 67 | 68 | if TEST_MODEL_NAME in bw2.projects: 69 | bw2.projects.delete_project(name=TEST_MODEL_NAME)#, delete_dir=True) 70 | #bw2.projects.purge_deleted_directories() 71 | 72 | 73 | print('rewriting original config') 74 | 75 | storage.write_config(ORIGINAL_CONFIG) 76 | 77 | assert storage.config == ORIGINAL_CONFIG 78 | 79 | request.addfinalizer(teardown_fixtures) 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /dist/lcopt-0.2.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pjamesjoyce/lcopt/a167ecfa258e62e91af7dac6cbf70be5d63fff93/dist/lcopt-0.2.2.tar.gz -------------------------------------------------------------------------------- /dist/lcopt-0.3.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pjamesjoyce/lcopt/a167ecfa258e62e91af7dac6cbf70be5d63fff93/dist/lcopt-0.3.0.tar.gz -------------------------------------------------------------------------------- /dist/lcopt-0.3.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pjamesjoyce/lcopt/a167ecfa258e62e91af7dac6cbf70be5d63fff93/dist/lcopt-0.3.1.tar.gz -------------------------------------------------------------------------------- /docs/1_installation.rst: -------------------------------------------------------------------------------- 1 | ============ 2 | Installation 3 | ============ 4 | 5 | .. highlight:: console 6 | 7 | ------------------ 8 | Basic Installation 9 | ------------------ 10 | 11 | Recommended Installation 12 | ------------------------ 13 | 14 | The easiest way to install lcopt is via conda. This ensures the version of Python (3.6) is correct, all of the dependencies are correct and there are no conflicts. 15 | You can also do it in only 3 commands. 16 | 17 | If you don't have conda installed yet, first install Miniconda (available `here `_) 18 | 19 | 1) On the command line/console, create a new environment called lcopt:: 20 | 21 | conda create -n lcopt python=3.6 22 | 23 | 2) Activate the lcopt environment using one of these:: 24 | 25 | # Mac/Linux 26 | source activate lcopt 27 | # Windows 28 | activate lcopt 29 | 30 | 3) Install lcopt:: 31 | 32 | conda install -y -q -c conda-forge -c cmutel -c haasad -c pjamesjoyce lcopt 33 | 34 | .. _bw2_setup_step: 35 | 36 | ----------------------------------------------------- 37 | Setting up brightway2 for lcopt 38 | ----------------------------------------------------- 39 | 40 | To use the interactive analysis feature, you need to set up brightway2 to play nicely with lcopt. 41 | 42 | Lcopt needs to set up its own brightway project template so that it can create a new brightway project for each of your models using this template. 43 | 44 | Step 1. Download the Ecoinvent 3.3 cutoff database (Ecoinvent license required) 45 | -------------------------------------------------------------------------------------- 46 | 47 | .. note:: Note - if you don't have an ecoinvent license but want to try out lcopt, it can also be used with the freely available FORWAST database :ref:`forwast_setup_step`. 48 | 49 | 50 | Log into `ecoinvent.org `_ and go to the Files tab 51 | 52 | Download the file called ``ecoinvent 3.3_cutoff_ecoSpold02.7z`` 53 | 54 | Extract the file somewhere sensible on your machine, you might need to download `7-zip `_ to extract the files. 55 | 56 | Make a note of the path of the folder that contains the .ecospold files, its probably ``/datasets/`` 57 | 58 | Step 2a. lcopt-bw2-setup at the command line 59 | -------------------------------------------- 60 | 61 | .. highlight:: console 62 | 63 | At the command line type:: 64 | 65 | lcopt-bw2-setup path/to/ecospold/files # use "" if there are spaces in your path 66 | 67 | 68 | Step 2b. Or run the setup utility in a jupyter notebook/python shell 69 | -------------------------------------------------------------------- 70 | 71 | .. highlight:: python 72 | 73 | Fire up your chosen python shell, then use:: 74 | 75 | from lcopt.utils import lcopt_bw2_setup 76 | ecospold_path = r'path/to/ecospold/files' # put your own path in here 77 | lcopt_bw2_setup(ecospold_path) 78 | 79 | It'll take a while, but once its done it'll return ``True`` if it worked properly. 80 | 81 | Running the setup utility in a python shell also allows you to overwrite your existing configuration if something has gone wrong by using ``lcopt_bw2_setup(ecospold_path, overwrite=True)`` 82 | 83 | .. _forwast_setup_step: 84 | 85 | --------------------------- 86 | Alternative setup - FORWAST 87 | --------------------------- 88 | 89 | Lcopt can be used without an ecoinvent license by using the `FORWAST `_ database instead. 90 | 91 | Option 1. Download lcopt_bw2_setup.py and use that instead 92 | ---------------------------------------------------------- 93 | 94 | .. highlight:: console 95 | 96 | At the command line type:: 97 | 98 | lcopt-bw2-setup-forwast 99 | 100 | Option 2. Run the setup utility in a jupyter notebook/python shell 101 | ------------------------------------------------------------------ 102 | 103 | .. highlight:: python 104 | 105 | Fire up your chosen python shell, then use:: 106 | 107 | from lcopt.utils import lcopt_bw2_forwast_setup 108 | lcopt_bw2_forwast_setup() 109 | 110 | It'll take a while, but once its done it'll return ``True`` if it worked properly. 111 | 112 | As above, you can overwrite an existing configuration using ``overwrite=True`` 113 | -------------------------------------------------------------------------------- /docs/2_Getting_Started.rst: -------------------------------------------------------------------------------- 1 | .. _getting_started: 2 | 3 | =============== 4 | Getting Started 5 | =============== 6 | 7 | .. sidebar:: Set up the background databases 8 | 9 | :ref:`Set up with ecoinvent` 10 | 11 | :ref:`Set up with FORWAST` 12 | 13 | The best way to get started with Lcopt is to explore one of the example models. 14 | 15 | First make sure you've set up either ecoinvent or FORWAST as a background database. 16 | 17 | .. highlight:: console 18 | 19 | Then activate your lcopt environment, and use the command line command `lcopt-launcher` to launch Lcopt :: 20 | 21 | activate lcopt 22 | cd C:\Users\pjjoyce\Documents\01_Lcopt_models 23 | lcopt-launcher 24 | 25 | This dialog will appear: 26 | 27 | .. image:: assets/lcopt_launcher_dialog.jpg 28 | 29 | Choose *Open Example Model* 30 | 31 | The video below runs through the steps required to make the example model. 32 | 33 | .. _video: 34 | 35 | Video 36 | ----- 37 | .. raw:: html 38 | 39 | 42 | 43 | -------------------------------------------------------------------------------- /docs/3_use.rst: -------------------------------------------------------------------------------- 1 | =========== 2 | Using Lcopt 3 | =========== 4 | 5 | ------------------------------------ 6 | Creating and loading your own models 7 | ------------------------------------ 8 | 9 | There are 2 options for using lcopt's GUI (LCOPT INTERACT) to create and view your own models 10 | 11 | Option 1. lcopt-launcher command line entry point *(Simpler, only access to GUI)* 12 | --------------------------------------------------------------------------------- 13 | 14 | Using this option, you can launch lcopt from the command line/console and use the GUI from then on. 15 | 16 | Open the console/command line. 17 | 18 | .. highlight:: console 19 | 20 | Activate your *lcopt* environment, ``cd`` into the folder you want to store your model in then simply use ``lcopt-launcher`` :: 21 | 22 | activate lcopt 23 | cd C:\Users\pjjoyce\Documents\01_Lcopt_models 24 | lcopt-launcher 25 | 26 | 27 | You'll get an option to either create a new model or load an existing one (or to view the example model). 28 | 29 | If you choose to create a model you will be prompted for a name - this will be the model's name and the default filename. 30 | 31 | If you choose to load a model a file dialog will open and allow you to choose an existing ``.lcopt`` file. 32 | 33 | Once you've made your choice, the GUI will open in your default browser. 34 | 35 | Option 2. Jupyter notebooks *(More complicated, more powerful)* 36 | --------------------------------------------------------------- 37 | 38 | Probably the best way to use lcopt is via a jupyter notebook. This gives you more access to the inner workings if you need to get at something you can't see in the GUI. 39 | 40 | .. highlight:: console 41 | 42 | ``cd`` into whatever folder you want your notebooks and lcopt models to be stored in, then start jupyter e.g.:: 43 | 44 | activate lcopt 45 | cd C:\Users\pjjoyce\Documents\01_Lcopt_models 46 | jupyter notebook 47 | 48 | This will fire up the jupyter notebook server in your browser. 49 | Create a new notebook, give it a meaningful name. 50 | 51 | .. highlight:: python 52 | 53 | Then in the first cell import lcopt:: 54 | 55 | from lcopt import * 56 | 57 | Next create your LcoptModel:: 58 | 59 | model = LcoptModel('MyFirstModel') 60 | 61 | or load an existing one:: 62 | 63 | model = LcoptModel(load = 'MyFirstModel') 64 | 65 | .. note:: If you are using FORWAST instead of ecoinvent, you need to add the argument `useForwast=True` e.g. `model = LcoptModel(load = 'MyFirstModel', useForwast=True)` 66 | 67 | Then launch the interactive model creator/analyser:: 68 | 69 | model.launch_interact() 70 | 71 | ------------------------ 72 | LCOPT INTERACT - the GUI 73 | ------------------------ 74 | 75 | Running the GUI via each of the options above launches a Flask server that gives you a nice UI to interact with the models. You can add processes, link them together, add biosphere and technosphere exchanges, and create parameter sets and functions using your parameters. It should be pretty intuitive, if you get stuck, try the 'more info...' buttons. 76 | 77 | See the :ref:`video