Closed m-jamieson closed 3 years ago
Started an attempt at doing this on my fork and I think its working ok. Im sure it can be improved upon. https://github.com/bl-young/ElectricityLCI/commit/280675f68d2aa5964a1bbcf96dc7acc0488a465a
But then can use something like this:
import electricitylci as elci
import electricitylci.globals
electricitylci.globals.set_model_name_with_stdin=False
import electricitylci.model_config as config
config.model_name = 'ELCI_1'
df = elci.get_gen_plus_netl()
It seems a shame that the import line had to be added in all those places init.py, but I can't think of a clever way around it.
Yes, I think we might be able to move things around such that the model config inputs are generated in or called from main.py. But I'd need to spend some more time with it to get it straightened out. I would assume this is not something that is necessary to be implemented in v1.0.1, but I'll see what I can do.
Pull request #134, courtesy of @bl-young.
Additionally, commit 5e5fc75 added command line model configurations.
There doesn't appear to be a way to avoid the interactive prompt to choose a configuration - it happens immediately when importing anything from the module. One could change the globals.py variable
set_model_name_with_stdin
to False, but I don't really like creating a situation where main.py is so easily broken.I think there's something to ensuring main.py prompts for a configuration but import elci on it's own does not. If you're importing it, maybe it should be up to the user to run a function or something to define a configuration.
Thanks @bl-young