magpiemodel / magpie

Model of Agricultural Production and its Impact on the Environment (MAgPIE) - model code
Other
99 stars 167 forks source link

Fix division by zero in yield calibration #679

Closed DavidhoPIK closed 4 months ago

DavidhoPIK commented 4 months ago

:bird: Description of this PR :bird:

This PR fixes a division by zero error that occures when using the h16 or h16s5 region mapping using 67k preprocessing.

The value sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14)) in LN 130 of the preloop is above but very close to zero. Like this the >0 condition is fulfilled but still LN 134 results in division by zero.

:wrench: Checklist for PR creator :wrench:

:chart_with_downwards_trend: Performance changes :chart_with_upwards_trend:

:rotating_light: Checklist for reviewer :rotating_light: