pjamesjoyce / lcopt

Create foreground LCA models via an intuitive user interface and analyse them using Brightway2
BSD 3-Clause "New" or "Revised" License
22 stars 6 forks source link

New project required for every model? #37

Closed haasad closed 6 years ago

haasad commented 6 years ago

Is there a reason why the default project is copied every time I run a new model? Would it be possible to just store the foreground processes as a model-database without copying the background ecoinvent db to a new project?

I feel like the current behaviour is not sustainable concerning disk-space. Eg. just by running the example model once, it uses 1.2 GB:

du -sh ~/.local/share/Brightway3/{Example,LCOPT}*
611M    /home/adrian/.local/share/Brightway3/Example-Model.83f1523a38d449a5f01f155646baa42c
611M    /home/adrian/.local/share/Brightway3/LCOPT_Setup.6406c9070ff742ba1c4b9f7c5d4acaf9
pjamesjoyce commented 6 years ago

Hi @haasad, there were a couple of reasons, but nothing that would prevent this being an option in theory.

The first reason is that from the docs and examples I gathered it was Brightway2 best practice to keep projects separate. The examples all seem to begin either with a new project being set up, or the Brightway introduction project being copied.

The second reason is it seemed a bit tidier to keep each lcopt project separate. An .lcopt file is essentially a blueprint of how to create a brightway project. If you email someone a 6MB lcopt project, they can use it to automatically generate an identical brightway project.

I've been playing with the idea of a config or settings file so that 'power-users' could persistantly change certain options (the first thing in there is a way to save your ecoinvent login). I'll look into having an option in there to choose to save all new lcopt projects as a database in a single project instead of creating a new project every time

haasad commented 6 years ago

Having this option to choose to store all models in a single project would be great.

I saw in your projects tab that you're still deciding where to store the config file. We just had this discussion for the AB and I strongly recommend appdirs: https://github.com/LCA-ActivityBrowser/activity-browser/pull/176. It solves a lot of platform-specific headache and it's also what Chris uses for brightway. I would even suggest to store the models in an appdirs directory instead of the current directory. I can make a small PR for this if you're interested.

pjamesjoyce commented 6 years ago

Thanks @haasad - appdirs looks like a great option. If you have time to put together a small PR that would be fantastic!

pjamesjoyce commented 6 years ago

@haasad take a look at the config branch (still not fully tested so i've not pulled it into dev yet)

This uses your appdirs PR to add the option to specify in the config file where the lcopt models sent to brightway get put.

The config file is yaml and looks like this:

ecoinvent:    # optional
  password: super_secret_password    # optional
  username: my_login    # optional
model_storage:
  location: appdir    # alternative is 'currdir' to keep previous behaviour
  project: single     # alternative (and default) is 'unique' to create unique projects for each model
  single_project_name: My_LCOPT_Projects    # optional (defaults to 'LCOPT_Models')
pjamesjoyce commented 6 years ago

Note: appdirr vs currdir isn't implemented yet

pjamesjoyce commented 6 years ago

Note: appdirr vs currdir isn't implemented yet

It is now, hopefully...

haasad commented 6 years ago

Works flawlessly :+1: This is great, thanks for taking the time to implement this!

Is the user supposed to change the config via text editor or do you plan to add some kind of interface (helper-functions) to change the config values? Maybe it's there and i missed it, but I think both options are fine.

pjamesjoyce commented 6 years ago

Excellent!

Is the user supposed to change the config via text editor or do you plan to add some kind of interface (helper-functions) to change the config values?

At the moment its only possible via a text editor, but a 'settings' interface is a good idea. I'll start a new issue for that.