-
Notifications
You must be signed in to change notification settings - Fork 7
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
Check that id_loan
is not duplicated
#164
Conversation
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.
Looks good. I suggested a change and I plan to do it myself.
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.
Thanks Jackson, I approve. If appropriate, please remember to update NEWS.md; and to close the relevant issue(s) -- maybe via the commit message when you squash-merge.
This relates to a bug identified by multiple users, where
projected
emission_factors
were unreasonably large.This was a result of the input data having duplicate
id_loans
per loan. The result was that, while the loan weights was calculated perid_loan
, theemission_factor
was summed across each loan weight, causing double-counting (sometimes more).I decided to go the more harsh route, and cause the function to
error
if inputid_loans
were duplicated. This will save us headache down the road, as theseid
s should uniquely identify EVERY loan (otherwise we're gonna have problems).I also noticed that the
emission_factor
was still being weighted whenby_company = TRUE
which doesn't make sense, so fixed that as well.Maybe closes #160