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

Change to defaulting of intensities, hopefully to fix problem with Egypt

parent f27d29e1
No related branches found
No related tags found
No related merge requests found
......@@ -119,16 +119,23 @@ public class GamsLocationOptimiser {
double prevFertI, prevIrrigI, prevOtherI;
Intensity intensity = landUseItem.getIntensity(cropType);
double defaultI = CropType.PASTURE == cropType ? 0.01 : 0.5;
if (intensity==null) { // could be first time through or this crop not previously grown in this location, so give it some default values
double defaultI = CropType.PASTURE == cropType ? 0.01 : 0.5;
prevFertI = defaultI;
prevIrrigI = defaultI;
prevOtherI = defaultI;
}
else {
prevFertI = intensity.getFertiliserIntensity();
prevIrrigI = intensity.getIrrigationIntensity();
prevOtherI = intensity.getOtherIntensity();
if (prevOtherI == 0) { // this is needed or optimizer gets a bit confused if some areas are kept as cropland but are not productive, due to zero other intensity (i.e. set aside)
prevFertI = defaultI;
prevIrrigI = defaultI;
}
else {
prevFertI = intensity.getFertiliserIntensity();
prevIrrigI = intensity.getIrrigationIntensity();
}
}
if (DEBUG) LogWriter.println(String.format(" %d %15s,\t %.2f,\t %.3f,\t %.3f,\t %.3f", locationId, cropType.getGamsName(), area, prevFertI, prevIrrigI, prevOtherI));
......
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