Skip to content
Snippets Groups Projects
Commit 7d3258f2 authored by rhenry2's avatar rhenry2
Browse files

small fix (hopefully)

parent ed34f530
No related branches found
No related tags found
No related merge requests found
......@@ -129,6 +129,9 @@ public class GamsRasterOptimiser {
double prevForestToNaturalFraction = (prevNatural > 0) ? prevForestTotal / prevNatural : 0;
double prevForestManagedFraction = (prevForestTotal > 0) ? prevManagedForest / prevForestTotal : 0;
if(prevForestToNaturalFraction > 1.0) prevForestToNaturalFraction = 1.0;
if(prevForestManagedFraction > 1.0) prevForestManagedFraction = 1.0;
//this tries to honour spatial distribution of protected areas, force removal of pasture and cropland from protected areas
if (ModelConfig.FORCE_PROTECTED_AREAS && year >= ModelConfig.FORCE_PROTECTED_AREAS_START_YEAR) {
double protectedLandShortfall = 0;
......
......@@ -239,10 +239,12 @@ public class LandUseItem implements InterpolatingRasterItem<LandUseItem>, Serial
}
public void setLandCoverArea(LandCoverType c, double d) {
if (Double.isNaN(d) || Double.isInfinite(d) || d < 0)
if (Double.isNaN(d) || Double.isInfinite(d))
throw new RuntimeException("AreasItem for " + c + " is " + d);
double landCover = (d < 0.0) ? 0.0 : d;
landCoverAreas.put(c, d);
landCoverAreas.put(c, landCover);
}
public double getTotalLandCoverArea() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment