solutions icon indicating copy to clipboard operation
solutions copied to clipboard

Figure out quirks setting replacement_period_offset

Open denised opened this issue 3 years ago • 2 comments

The Unit Adoption quirks setting replacement_period_offset is very strange --- I introduced it, but I don't understand it. The observed affect in the test results is an off-by-one error in what year replacement units get put in. Different models need this parameter set to either zero or one to get the right results. I don't know if this is because the models actually have different calculations, or if there is some more other bug in the python code that this somehow compensates for.
If there is a difference in the models, then it would be nice if the extractor could test for it somehow --- it is the most mysterious quriks setting.

denised avatar Oct 28 '21 21:10 denised

One thing which springs to mind is hitting an edge case in ROUND(). Excel's rounding behavior differs significantly from Python 3. There is an implementation which matches Excel's behavior: https://github.com/ProjectDrawdown/solutions/blob/develop/model/excel_math.py

DentonGentry avatar Oct 28 '21 23:10 DentonGentry

Yes, I thought that was the issue as well. Though the details escape me now, I convinced myself at the time I introduced the quirk that this was not the cause of the behavior. Of course, I may have been wrong :-)

-- Denise Draper @.***

On Thu, Oct 28, 2021, at 4:30 PM, Denton Gentry wrote:

One thing which springs to mind is hitting an edge case in ROUND(). Excel's rounding behavior differs significantly from Python 3. There is an implementation which matches Excel's behavior: https://github.com/ProjectDrawdown/solutions/blob/develop/model/excel_math.py

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ProjectDrawdown/solutions/issues/507#issuecomment-954297605, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAMTTVRMEEZCN7SDLXWLLUJHMIXANCNFSM5G53UF3A.

denised avatar Oct 28 '21 23:10 denised