Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple ecoinvent versions #36

Merged
merged 4 commits into from Jul 18, 2018
Merged

Conversation

pjamesjoyce
Copy link
Owner

This PR adds the ability to use any version of ecoinvent with lcopt (not just 3.3 cutoff).

It's possible due to the great work of @haasad on eidl.

This feature has been requested by @brezen90 and @cdgaete and is related to issues #34 and #23. It closes #35.

When you create a new LcoptModel from a shell or notebook you can now specify ecoinvent_version and ecoinvent_system_model as arguments. You'll be prompted for your ecoinvent username and password, and whether you want these credentials to be saved (useful if you're likely to want to use a different version of ecoinvent in future).

NOTE: If you choose to save the credentials for later, the password will be stored as plaintext in a .yml file on your computer - in theory this is no less secure than having it on a post-it on your desk, or a saved email, but something to be aware of. The default is 'no' to the save credentials question.

You can also add ei_username, ei_password and write_config (default is False) arguments to the LcoptModel instantiation if you don't want to type them in at the prompt.

The first time you use a version/system model combo, Lcopt will automatically set up a default bw2 project (called LCOPT_Setup_EcoinventX_X_systemmodel, e.g. LCOPT_Setup_Ecoinvent3_4_apos) with the biosphere and LCIA methods in it, and the correct version of ecoinvent. From then on, it'll copy this base project whenever you use that combo in future. This means you don't have to download, extract, write the whole of ecoinvent every time you start a new project.

NOTE: This also means that the set up brightway for Lcopt step of the installation isn't really necessary any more (except if you only use lcopt-launcher which will always look for the default setup)

Examples

First time:

model = LcoptModel("My first consequential model", ecoinvent_version="3.4", ecoinvent_system_model="consequential")
# prompt asks for:
ecoinvent username: my_username
ecoinvent password: ************
store username and password on this computer? y/[n]: y

# then it does the rest of the setup (takes about 5 mins)

Second time

model2 = LcoptModel("My second consequential model", ecoinvent_version="3.4", ecoinvent_system_model="consequential")
# it just works with no further setup

Specifying a username and password, and writing a config file to remember them:

model3 = LcoptModel("My first apos model", ecoinvent_version="3.4", ecoinvent_system_model="apos", ei_username="my_username", ei_password = "my_super_secret_password", write_config=True)
# No prompts, the setup runs automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Look into compatability with different ecoinvent versions
1 participant