-
Notifications
You must be signed in to change notification settings - Fork 12
Add a command to create example BMI implementation #3
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
Conversation
|
@mcflugen Definitely. Thank you! I'll use this in the BMI Live clinic. |
|
@mcflugen. this looks great. I couple of comments:
from bmipy import Bmi
import numpy
class update(Bmi):
def finalize(self) -> None:
"""Perform tear-down tasks for the model.
Perform all tasks that take place after exiting the model's time
loop. This typically includes deallocating memory, closing files and
printing reports.
"""
raise NotImplementedError("finalize")which indicates to me that filling in the correct class name is not working (and the last function, update) is being used instead.
A couple of additional notes on additional functionality that would be great (@mdpiper let me know what you think).
|
|
Running Python 3.6.8 I had issues with e.g. def get_input_var_names(self) -> Tuple[str]:
NameError: name 'Tuple' is not definedOnce I removed those, I had no errors. |
|
@kbarnhart Based on your comments, I've made a few improvements:
|
|
I can confirm that all three of your improvements worked for me! |
|
Since you are on a roll @mcflugen (🌟 🎉 ) I thought I'd write out my vision for adding a test example templates... For each command, if --make-example-tests flag was included, then the following would be appended to the docstring. where This way a user could very easily find replace on |
|
@kbarnhart I like your idea about adding example doctests. I will try to add that but as a separate pull request. |
|
Sounds good @mcflugen. I thought I'd at least write down what I was thinking of while I was thinking about it so I don't have to worry about forgetting.... Thanks for making this. As it stands its pretty spiffy! |
This pull request adds a simple command to create a template BMI implementation Python file that a user can fill in. It doesn't do too much right now but can be extened.
To get help,
To create a BMI template implementation,
$ bmipy-render ByBmi > mybmi.py@kbarnhart This isn't everything that you were wanting but I think it could at least provide a place for you to add addition functionality as you need it.
@mdpiper Maybe this is something you would be interested in as well?