inbo / niche_vlaanderen

Python package to run the NICHE Vlaanderen model
https://inbo.github.io/niche_vlaanderen/
MIT License
5 stars 0 forks source link

Check divide by zero warning in calibration #288

Closed johanvdw closed 1 year ago

johanvdw commented 1 year ago
100%|████████████████████████████████████████████████████████████████████| 14/14 [02:04<00:00,  8.92s/it]
/home/johan/Nextcloud/_proj/niche/niche_vlaanderen/niche_vlaanderen/bwk_overlay.py:210: RuntimeWarning: invalid value encountered in double_scalars
  area_pot_perc = area_pot / (area_pot + area_nonpot)
/home/johan/Nextcloud/_proj/niche/niche_vlaanderen/niche_vlaanderen/bwk_overlay.py:214: RuntimeWarning: invalid value encountered in double_scalars
  [100 * area_pot / area_effective, 100]
/home/johan/Nextcloud/_proj/niche/niche_vlaanderen/niche_vlaanderen/bwk_overlay.py:214: RuntimeWarning: divide by zero encountered in double_scalars
  [100 * area_pot / area_effective, 100]

Perhaps pHab zero?

johanvdw commented 1 year ago

This issue seems to occur when small shapes are not overlapping with the middle part of a grid cell, and seems to be solved when specifying a higher upscaling factor.

Should be added to the documentation. And a clear warning should be given.

johanvdw commented 1 year ago

warning is added