-
Notifications
You must be signed in to change notification settings - Fork 136
Improve annuity calculation in economics tool #543
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
Nice! From the source code perspective, it does not adhere to pep8 (or our guidelines)...maybe this could be adapted? Otherwise I am fine with the improvement |
Thank you for improving this calculations.
def annuity(capex, n, wacc, u=None, cost_decrease=0)
"""...."""
if u is None:
u = n |
also changed syntax of return formula to adhere better to style guidelines
added "tex" formulation for proper visualization in readthedocs. modified description of input parameters
1 similar comment
within these last commits I have tried to: improve docstrings for clarity, add tests to cover additional inputs, adequate or get closer to pep8 (don't have much experience, is it now correct? how can it still be improved?), modify kwargs as suggested by @uvchik |
please, could you review logging block? I have seen different criteria for logging along different files. Otherwise, any suggestion on how to improve test coverage by adding an example that checks those logging lines? |
Thank you for the changes. Tests looks good. I just fixed a few pep8 Issues but in general everything was fine. Sometimes we use logging warnings but the attention level is quite low. So I would rather raise a python warning or even an error if something is wrong. Warning: The results might be unrealistic due to a strange combination of parameters but in some (rare) cases it might be okay. In that case it has to be possible to switch off the warning because a warning is annoying, if the results are okay. Error: No chance of getting good results with this combination of input parameters. In most cases I prefer raising an error or doing nothing. @lluismillet Does it help? |
Thank you for the corrections and the tips.
is True, a python error will raise by itself as a division by zero will be encountered within the return clause. |
It might help the user so you can keep the if statement but raise an error instead of a logging warning: if ....:
raise ValueError("Input arguments for annuity function out of bounds!") |
Trying to adopt this error raising I figured out I do not have rights to commit on this branch anymore.. |
Sure? According to the team lists you should have writing access. |
sorry, it was just a firewall problem. |
Thanks. I added a test to test the |
Looks good to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring uses abbreviations for the formulas. I will approve this here, as it is common practice. However, I would advice symbols.
Describe your pull request as transparent as possible:
The annuity function in the economics tool has been supplemented by possible multiple investment and cost decreases. Both parameters ('u', 'cost_decrease') can be set optionally. If not set, the function works as before.
Related issues:
The function was suggested by a user on the last user meeting: https://github.com/baumconsult/gridcon/blob/master/economics_BAUM_171221.py
This is now the output of the working group from the last developer meeting.
This issue Add economic calculations to oemof oemof-tools#9 might also be related.