Make `Impact.impact_at_reg` support all zero impacts by peanutfun · Pull Request #773 · CLIMADA-project/climada_python
When calibrating impact functions (see #692), one usually aggregates impacts in space, and impact_at_reg is the "canonical" way of doing that. When the optimization algorithm explores possible parameter sets, it might happen that the computed impact is zero everywhere. However, the calibration cannot recover from the error thrown in this case and aborts.
One has to distinguish two cases.
- If
save_mat=False,impact_at_regcannot work, so I think throwing an error is fine. However, there is no way of knowing that for sure from theImpactobject. By default, the impact matrix should be empty with shape (0, 0). - If
save_mat=True, it might very well be that all values are zero and computing the spatial aggregate will also return zero. However, this should not be an error (currently, it is), and I also don't see why this should issue a warning. It's simply the arithmetic result.