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

Allow model configuration to be set via code #115

Closed
m-jamieson opened this issue Jul 16, 2020 · 4 comments
Closed

Allow model configuration to be set via code #115

m-jamieson opened this issue Jul 16, 2020 · 4 comments

Comments

@m-jamieson
Copy link
Collaborator

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

@bl-young
Copy link
Collaborator

Started an attempt at doing this on my fork and I think its working ok. Im sure it can be improved upon.
bl-young@280675f

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()

@m-jamieson
Copy link
Collaborator Author

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.

@bl-young
Copy link
Collaborator

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.

@m-jamieson
Copy link
Collaborator Author

Pull request #134, courtesy of @bl-young.

Additionally, commit 5e5fc75 added command line model configurations.

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

No branches or pull requests

2 participants