Skip to content
Snippets Groups Projects
Commit 195e9d21 authored by Peter Alexander's avatar Peter Alexander
Browse files

Be able to use existing cluster files even for calibration

parent a031e2f2
No related branches found
No related tags found
No related merge requests found
...@@ -173,6 +173,7 @@ public class ModelConfig { ...@@ -173,6 +173,7 @@ public class ModelConfig {
public static final double INITIAL_PRICE_SHIFT = getDoubleProperty("INITIAL_PRICE_SHIFT", 1.0); 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 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 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 // Temporal configuration
public static final int START_TIMESTEP = getIntProperty("START_TIMESTEP", 0); public static final int START_TIMESTEP = getIntProperty("START_TIMESTEP", 0);
......
...@@ -103,7 +103,7 @@ public class ModelMain { ...@@ -103,7 +103,7 @@ public class ModelMain {
fpuManager = new FPUManager(desiredProjection); fpuManager = new FPUManager(desiredProjection);
currentIrrigationData = getFixedIrrigationData(); currentIrrigationData = getFixedIrrigationData();
countryBoundaryRaster = getCountryBoundaryRaster(); 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(); initLU = getInitialLandUse();
countryAgents = createCountryAgents(compositeCountryManager.getAll()); countryAgents = createCountryAgents(compositeCountryManager.getAll());
...@@ -194,7 +194,7 @@ public class ModelMain { ...@@ -194,7 +194,7 @@ public class ModelMain {
// if first timestep and calibration get the clustering info, which // if first timestep and calibration get the clustering info, which
// doesn't change through time // doesn't change through time
if (ModelConfig.IS_CALIBRATION_RUN && timestep.isInitialTimestep()) if (ModelConfig.GENERATE_NEW_YIELD_CLUSTERS && timestep.isInitialTimestep())
clusterIdRaster.putAll(ca.getYieldClusters()); clusterIdRaster.putAll(ca.getYieldClusters());
// Get values for world input costs // Get values for world input costs
...@@ -360,15 +360,15 @@ public class ModelMain { ...@@ -360,15 +360,15 @@ public class ModelMain {
} }
} }
if (ModelConfig.IS_CALIBRATION_RUN) { if (ModelConfig.IS_CALIBRATION_RUN)
serializeLandUse(landUseRaster); serializeLandUse(landUseRaster);
if (timestep.isInitialTimestep()) if (timestep.isInitialTimestep()) {
if (ModelConfig.GENERATE_NEW_YIELD_CLUSTERS)
outputClusters(clusterIdRaster); outputClusters(clusterIdRaster);
}
if (timestep.isInitialTimestep())
outputWaterAvailablity(currentIrrigationData); outputWaterAvailablity(currentIrrigationData);
}
// Output LandUses to tabular file, for analysis (perhaps) // Output LandUses to tabular file, for analysis (perhaps)
LogWriter.println("Outputing land uses Year: " + timestep.getYear()); LogWriter.println("Outputing land uses Year: " + timestep.getYear());
...@@ -450,7 +450,7 @@ public class ModelMain { ...@@ -450,7 +450,7 @@ public class ModelMain {
LogWriter.printlnError("No commodities data for " + cc + ", so skipping"); LogWriter.printlnError("No commodities data for " + cc + ", so skipping");
} else { } else {
RasterSet<LandUseItem> initCountryLandUse = initLU.createSubsetForKeys(keys); 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) { if (initCountryLandUse.size() == 0) {
LogWriter.printlnError("No initial land use for " + cc + ", so skipping"); LogWriter.printlnError("No initial land use for " + cc + ", so skipping");
......
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