USEPA / ElectricityLCI

Creative Commons Zero v1.0 Universal
24 stars 10 forks source link

Addition of ModelSpecs class and assignment of model configuration #128

Closed bl-young closed 3 years ago

bl-young commented 3 years ago

In attempting to find a solution to #115, I also went ahead and converted the model specs to a class. -Variables from model_config.py combined into a class to better facilitate importing of model_specs -References to the specific model_specs have been shifted to references to the model_specs class -New functions in model_config to prompt user for model number and load and build model -Explicitly require 'build_model_class' in main.py to select the configuration, and assign it back to model_config

-Remove the prompt to select a model if only importing via init: The following can be run to access any functions within eLCI:

import electricitylci as elci
import electricitylci.model_config as config
config.model_specs = config.build_model_class("ELCI_1")

Passing no parameter to build_model_class will prompt the users to select a model

model parameters can then be changed individually as needed: config.model_specs.electricity_lci_target_year = 2040

All three configurations succesfully built in this branch.

bl-young commented 3 years ago

@WesIngwersen @jump2conclusionsmatt I understand we may not want to implement at this point, but wanted to at least pitch you on the idea

WesIngwersen commented 3 years ago

Tested it with

pip install git+https://github.com/bl-young/ElectricityLCI.git@issue115#egg=electricitylci

and from python

import electricitylci

did not prompt for model selection. then ran from the command line

python -m electricitylci.main

and it does then force a model selection, so it works for me.

m-jamieson commented 3 years ago

As long as it's working, good by me. I'll check it out while I'm working on the other fixes.

m-jamieson commented 3 years ago

Can we hold off on this until some of the other branches are merged in? I'm hopeful that will simplify conflict resolution. If we wait until the end, I'm hopeful that Ben's changes will override some of my uses of the old style model configuration parameters. Maybe it won't matter and it'll be painful no matter what.

m-jamieson commented 3 years ago

Actually thinking about it some more, I think it would be best to do a development branch, pull all the various issues branches into it and test from there. I'll at least do that for my various issues branches.

WesIngwersen commented 3 years ago

Actually thinking about it some more, I think it would be best to do a development branch, pull all the various issues branches into it and test from there. I'll at least do that for my various issues branches.

OK fine by me @jump2conclusionsmatt