diff --git a/src/ac/ed/lurg/ModelConfig.java b/src/ac/ed/lurg/ModelConfig.java index d9f8af75457c4401fc510a43630c5558f6ececbe..1ed818b94b0de45bcb9651af16e7fec62a4593e6 100644 --- a/src/ac/ed/lurg/ModelConfig.java +++ b/src/ac/ed/lurg/ModelConfig.java @@ -173,6 +173,7 @@ public class ModelConfig { public static final double INITIAL_PRICE_SHIFT = getDoubleProperty("INITIAL_PRICE_SHIFT", 1.0); public static final boolean CHANGE_YIELD_DATA_YEAR = IS_CALIBRATION_RUN ? false : getBooleanProperty("CHANGE_YIELD_DATA_YEAR", true); public static final String CLUSTERED_YIELD_FILE = getProperty("CLUSTERED_YIELD_FILE", OUTPUT_DIR + File.separator + "cluster.asc"); + public static final boolean GENERATE_NEW_YIELD_CLUSTERS = getBooleanProperty("GENERATE_NEW_YIELD_CLUSTERS", IS_CALIBRATION_RUN); // Temporal configuration public static final int START_TIMESTEP = getIntProperty("START_TIMESTEP", 0); diff --git a/src/ac/ed/lurg/ModelMain.java b/src/ac/ed/lurg/ModelMain.java index 283dafbb9d0598e902c64e97e1519413b4ea6b10..c57f78c474f46c4687e9fae8ea21bc330969c9b0 100644 --- a/src/ac/ed/lurg/ModelMain.java +++ b/src/ac/ed/lurg/ModelMain.java @@ -103,7 +103,7 @@ public class ModelMain { fpuManager = new FPUManager(desiredProjection); currentIrrigationData = getFixedIrrigationData(); countryBoundaryRaster = getCountryBoundaryRaster(); - clusterIdRaster = (ModelConfig.IS_CALIBRATION_RUN) ? new RasterSet<IntegerRasterItem>(desiredProjection) : getClusterRaster(); + clusterIdRaster = ModelConfig.GENERATE_NEW_YIELD_CLUSTERS ? new RasterSet<IntegerRasterItem>(desiredProjection) : getClusterRaster(); initLU = getInitialLandUse(); countryAgents = createCountryAgents(compositeCountryManager.getAll()); @@ -194,7 +194,7 @@ public class ModelMain { // if first timestep and calibration get the clustering info, which // doesn't change through time - if (ModelConfig.IS_CALIBRATION_RUN && timestep.isInitialTimestep()) + if (ModelConfig.GENERATE_NEW_YIELD_CLUSTERS && timestep.isInitialTimestep()) clusterIdRaster.putAll(ca.getYieldClusters()); // Get values for world input costs @@ -360,15 +360,15 @@ public class ModelMain { } } - if (ModelConfig.IS_CALIBRATION_RUN) { + if (ModelConfig.IS_CALIBRATION_RUN) serializeLandUse(landUseRaster); - if (timestep.isInitialTimestep()) + if (timestep.isInitialTimestep()) { + if (ModelConfig.GENERATE_NEW_YIELD_CLUSTERS) outputClusters(clusterIdRaster); - } - - if (timestep.isInitialTimestep()) + outputWaterAvailablity(currentIrrigationData); + } // Output LandUses to tabular file, for analysis (perhaps) LogWriter.println("Outputing land uses Year: " + timestep.getYear()); @@ -450,7 +450,7 @@ public class ModelMain { LogWriter.printlnError("No commodities data for " + cc + ", so skipping"); } else { RasterSet<LandUseItem> initCountryLandUse = initLU.createSubsetForKeys(keys); - RasterSet<IntegerRasterItem> yieldClusters = (ModelConfig.IS_CALIBRATION_RUN) ? null : clusterIdRaster.createSubsetForKeys(keys); + RasterSet<IntegerRasterItem> yieldClusters = ModelConfig.GENERATE_NEW_YIELD_CLUSTERS ? null : clusterIdRaster.createSubsetForKeys(keys); if (initCountryLandUse.size() == 0) { LogWriter.printlnError("No initial land use for " + cc + ", so skipping");