From 0389e6a4eff37bb852c80c6458a2834c7b2a3a3c Mon Sep 17 00:00:00 2001 From: Bart Arendarczyk <s1924442@ed.ac.uk> Date: Fri, 15 Nov 2024 15:57:31 +0000 Subject: [PATCH] Protected areas floating point errors fix. --- src/ac/ed/lurg/landuse/LandUseItem.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ac/ed/lurg/landuse/LandUseItem.java b/src/ac/ed/lurg/landuse/LandUseItem.java index 61ff9c0..6868789 100644 --- a/src/ac/ed/lurg/landuse/LandUseItem.java +++ b/src/ac/ed/lurg/landuse/LandUseItem.java @@ -323,7 +323,7 @@ public class LandUseItem implements InterpolatingRasterItem<LandUseItem>, Serial LandCoverType toLc = ModelConfig.ENABLE_LAND_SHARING || lcType.equals(LandCoverType.BARREN) ? lcType : LandCoverType.NATURAL; LandKey toKey = new LandKey(toLc, LandProtectionType.PROTECTED); double a = Math.min(getLandCoverArea(fromKey), diffArea); - if (a < 1e-9) { + if (a < 1e-10) { continue; } moveAreas(fromKey, toKey, a); @@ -338,7 +338,7 @@ public class LandUseItem implements InterpolatingRasterItem<LandUseItem>, Serial LandKey fromKey = new LandKey(lcType, LandProtectionType.PROTECTED); LandKey toKey = new LandKey(lcType, LandProtectionType.UNPROTECTED); double a = Math.min(getLandCoverArea(fromKey), diffArea); - if (a < 1e-9) { + if (a < 1e-10) { continue; } moveAreas(fromKey, toKey, a); -- GitLab