From 427d6e017a70b57359dafd9f1157240061a6d014 Mon Sep 17 00:00:00 2001 From: R0slyn <roslyn.henry.08@aberdeen.ac.uk> Date: Mon, 21 Aug 2017 09:19:31 +0100 Subject: [PATCH] converting irrigation constraint from km3 to mm --- src/ac/ed/lurg/ModelConfig.java | 2 +- src/ac/ed/lurg/landuse/FPUManager.java | 1 + src/ac/ed/lurg/landuse/IrrigationRasterSet.java | 9 +++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ac/ed/lurg/ModelConfig.java b/src/ac/ed/lurg/ModelConfig.java index 99c9e1c5..37ebdc8d 100644 --- a/src/ac/ed/lurg/ModelConfig.java +++ b/src/ac/ed/lurg/ModelConfig.java @@ -207,7 +207,7 @@ public class ModelConfig { public static final double IRRIGIATION_EFFICIENCY = getDoubleProperty("IRRIGIATION_EFFICIENCY", 0.5); public static final double ENVIRONMENTAL_WATER_CONSTRAINT = getDoubleProperty("ENVIRONMENTAL_WATER_CONSTRAINT", 1.0); public static final double WATER_AVAILIBILITY_RATE_OF_CHANGE = IS_CALIBRATION_RUN ? 0.0 : getDoubleProperty("WATER_AVAILIBILITY_RATE_OF_CHANGE", 0.0); - public static final boolean USE_BLUE_WATER_FILE_IRRIG_CONSTRAINT = getBooleanProperty("USE_BLUE_WATER_FILE_IRRIG_CONSTRAINT", true);; + public static final boolean USE_BLUE_WATER_FILE_IRRIG_CONSTRAINT = getBooleanProperty("USE_BLUE_WATER_FILE_IRRIG_CONSTRAINT", false);; public static final double LAND_CHANGE_COST = getDoubleProperty("LAND_CHANGE_COST", 0.7); public static final double CROP_TO_PASTURE_COST_FACTOR = getDoubleProperty("CROP_TO_PASTURE_COST_FACTOR", 1.0); diff --git a/src/ac/ed/lurg/landuse/FPUManager.java b/src/ac/ed/lurg/landuse/FPUManager.java index 5eb0a594..2cfc2a84 100644 --- a/src/ac/ed/lurg/landuse/FPUManager.java +++ b/src/ac/ed/lurg/landuse/FPUManager.java @@ -91,6 +91,7 @@ public class FPUManager { } public double getOtherWaterUse(Integer fpuId, Integer year) { + LogWriter.println(fpuId + " " + year); Double d = fpuOtherUses.get(fpuId).get(year); return d; } diff --git a/src/ac/ed/lurg/landuse/IrrigationRasterSet.java b/src/ac/ed/lurg/landuse/IrrigationRasterSet.java index c823ddda..d8823ac7 100644 --- a/src/ac/ed/lurg/landuse/IrrigationRasterSet.java +++ b/src/ac/ed/lurg/landuse/IrrigationRasterSet.java @@ -5,6 +5,7 @@ import java.util.Map; import ac.ed.lurg.ModelConfig; import ac.ed.lurg.Timestep; +import ac.ed.lurg.utils.LogWriter; import ac.sac.raster.IntegerRasterItem; import ac.sac.raster.RasterHeaderDetails; import ac.sac.raster.RasterKey; @@ -41,6 +42,7 @@ public class IrrigationRasterSet extends RasterSet<IrrigationItem> { double fpuRunOff = 0.0; double otherUses = 0.0; double waterAvailForIrrigPerCell = 0.0; + double waterAvailabileMm = 0.0; int cellCount = 0; for (Map.Entry<RasterKey, IrrigationItem> entry : irrigData.entrySet()) { @@ -59,10 +61,13 @@ public class IrrigationRasterSet extends RasterSet<IrrigationItem> { waterAvailForIrrigPerCell = 0; else waterAvailForIrrigPerCell = (fpuRunOffAvailable - otherUses) / cellCount; + for (Map.Entry<RasterKey, IrrigationItem> entry : irrigData.entrySet()) { - if (entry.getValue() != null) - entry.getValue().setIrrigConstraint(waterAvailForIrrigPerCell); + if (entry.getValue() != null){ + waterAvailabileMm = waterAvailForIrrigPerCell/fpuManager.fpuBoundaries.getAreaMha(entry.getKey())/0.01; + entry.getValue().setIrrigConstraint(waterAvailabileMm); + } } } } -- GitLab