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

Apply yield calibration factors

parent f13308c7
No related branches found
No related tags found
No related merge requests found
......@@ -104,6 +104,13 @@ public class ModelConfig {
public static final String ANPP_FILENAME = getProperty("ANPP_FILENAME", "anpp_plum.out");
public static final String YIELD_FILENAME = getProperty("YIELD_FILENAME", "yield_plum.out");
public static final double CALIB_FACTOR_WHEAT = getDoubleProperty("CALIB_FACTOR_WHEAT", 0.966);
public static final double CALIB_FACTOR_MAIZE = getDoubleProperty("CALIB_FACTOR_MAIZE", 0.631);
public static final double CALIB_FACTOR_RICE = getDoubleProperty("CALIB_FACTOR_RICE", 1.232);
public static final double CALIB_FACTOR_OILCROPS = getDoubleProperty("CALIB_FACTOR_OILCROPS", 0.192);
public static final double CALIB_FACTOR_PULSES = getDoubleProperty("CALIB_FACTOR_PULSES", 0.583);
public static final double CALIB_FACTOR_STARCHY_ROOTS = getDoubleProperty("CALIB_FACTOR_STARCHY_ROOTS", 6.027);
// Spatial (gridded) data
public static final double CELL_SIZE_X = getDoubleProperty("CELL_SIZE_X", 3.0);
public static final double CELL_SIZE_Y = getDoubleProperty("CELL_SIZE_Y", CELL_SIZE_X);
......
......@@ -6,18 +6,19 @@ import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import ac.ed.lurg.ModelConfig;
import ac.ed.lurg.utils.LogWriter;
public enum CropType {
WHEAT("WheatBarleyOats", "wheat"),
MAIZE("MaizeMilletSorghum", "maize"),
RICE("Rice (Paddy Equivalent)", "rice"),
WHEAT("WheatBarleyOats", "wheat", ModelConfig.CALIB_FACTOR_WHEAT),
MAIZE("MaizeMilletSorghum", "maize", ModelConfig.CALIB_FACTOR_MAIZE),
RICE("Rice (Paddy Equivalent)", "rice", ModelConfig.CALIB_FACTOR_RICE),
// TROPICAL_CEREALS("TropicalCereals", "tropicalCereals"),
OILCROPS("Oilcrops + (Total)", "oilcrops"),
OILCROPS("Oilcrops + (Total)", "oilcrops", ModelConfig.CALIB_FACTOR_OILCROPS),
// SOYBEAN("Soyabeans", "soybean"),
PULSES("Pulses + (Total)", "pulses"),
STARCHY_ROOTS("Starchy Roots + (Total)", "starchyRoots"),
PULSES("Pulses + (Total)", "pulses", ModelConfig.CALIB_FACTOR_PULSES),
STARCHY_ROOTS("Starchy Roots + (Total)", "starchyRoots", ModelConfig.CALIB_FACTOR_STARCHY_ROOTS),
MEAT("meatmilkeggs", "meat", true, true),
PASTURE("pasture", "pasture", false, false); // confusing having a land cover and a crop type. Needed here for yields (but not used for cropland area fractions).
......@@ -25,18 +26,20 @@ public enum CropType {
private String gamsName;
private boolean importedCrop;
private boolean isMeat;
private double calibrationFactor = 1.0;
private static Collection<CropType> importedCrops;
CropType (String faoName, String gamsName, boolean importedCrop, boolean isMeat) {
private CropType (String faoName, String gamsName, boolean importedCrop, boolean isMeat) {
this.faoName = faoName;
this.gamsName = gamsName;
this.importedCrop = importedCrop;
this.isMeat = isMeat;
}
CropType (String faoName, String gamsName) {
private CropType (String faoName, String gamsName, double calibrationFactor) {
this(faoName, gamsName, true, false);
this.calibrationFactor = calibrationFactor;
}
public static Collection<CropType> getCropsLessPasture() {
......@@ -116,4 +119,8 @@ public enum CropType {
public boolean isImportedCrop() {
return importedCrop;
}
public double getCalibrationFactor() {
return calibrationFactor;
}
}
......@@ -87,12 +87,12 @@ public class LPJYieldResponseMapReader {
double co = getValueForCol(rowValues, LPJCropTypes.MAIZE + fertIrrigString) * adjFactor;
double ri = getValueForCol(rowValues, LPJCropTypes.RICE + fertIrrigString) * adjFactor;
item.setYield(yieldType, CropType.WHEAT, isSpringWheat ? sw : ww);
item.setYield(yieldType, CropType.MAIZE, co);
item.setYield(yieldType, CropType.RICE, ri);
item.setYield(yieldType, CropType.OILCROPS, isSpringWheat ? sw : ww);
item.setYield(yieldType, CropType.PULSES, sw);
item.setYield(yieldType, CropType.STARCHY_ROOTS, sw);
setCalibratedYield(item, yieldType, CropType.WHEAT, isSpringWheat ? sw : ww);
setCalibratedYield(item, yieldType, CropType.MAIZE, co);
setCalibratedYield(item, yieldType, CropType.RICE, ri);
setCalibratedYield(item, yieldType, CropType.OILCROPS, isSpringWheat ? sw : ww);
setCalibratedYield(item, yieldType, CropType.PULSES, sw);
setCalibratedYield(item, yieldType, CropType.STARCHY_ROOTS, sw);
}
}
}
......@@ -100,4 +100,8 @@ public class LPJYieldResponseMapReader {
yieldReader.getRasterDataFromFile(fileToRead);
}
private void setCalibratedYield(YieldResponsesItem item, YieldType yieldType, CropType crop, double yield) {
item.setYield(yieldType, crop, yield * crop.getCalibrationFactor()); // this can't go on YieldResponsesItem.setYield as this is called from else where
}
}
\ No newline at end of file
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