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

Automated merge with bundle:/var/folders/q0/_71d_v6x7_db44ndq976wzym0000gn/T/SourceTreeTemp.pXJLP1

parents 33a076f1 6f7557f8
No related branches found
No related tags found
No related merge requests found
......@@ -100,7 +100,8 @@ public class ModelConfig {
public static final String OUTPUT_DIR = getProperty("OUTPUT_DIR", BASE_DIR + File.separator + "output");
public static final String TEMP_DIR = getProperty("TEMP_DIR", OUTPUT_DIR + File.separator + "GamsTmp");
public static final String DATA_DIR = getProperty("DATA_DIR", BASE_DIR + File.separator + "data");
public static final String GAMS_MODEL = getProperty("GAMS_MODEL", BASE_DIR + File.separator + "GAMS/IntExtOpt.gms");
public static final String GAMS_DIR = getProperty("GAMS_DIR", BASE_DIR + File.separator + "GAMS");
public static final String GAMS_MODEL = getProperty("GAMS_MODEL", GAMS_DIR + File.separator + "IntExtOpt.gms");
public static final boolean CLEANUP_GAMS_DIR = getBooleanProperty("CLEANUP_GAMS_DIR", false);
// Country (non-gridded) data
......@@ -216,10 +217,8 @@ public class ModelConfig {
public static final boolean ENABLE_GEN2_BIOENERGY = getBooleanProperty("ENABLE_GEN2_BIOENERGY", false);
public static final String BIOENERGY_DEMAND_SCENARIO = getProperty("BIOENERGY_DEMAND_SCENARIO", "BAU");
public static final double BIOENERGY_DEMAND_SHIFT = IS_CALIBRATION_RUN ? 1.0 : getDoubleProperty("BIOENERGY_DEMAND_SHIFT", 1.0);
// public static final double BIOENERGY_HEATING_VALUE_GJ_PER_T = getDoubleProperty("BIOENERGY_HEATING_VALUE_GJ_PER_T", 17.5); // GJ per t DM
public static final double MARKET_LAMBA = getDoubleProperty("MARKET_LAMBA", 0.4); // controls international market price adjustment rate
public static final double POPULATION_AGGREG_LIMIT = getDoubleProperty("POPULATION_AGGREG_LIMIT", 30.0); // in millions, smaller countries are aggregated on a regional basis
......@@ -247,6 +246,8 @@ public class ModelConfig {
public static final boolean DEBUG_JUST_DEMAND_OUTPUT = getBooleanProperty("DEBUG_JUST_DEMAND_OUTPUT", false);
public static final boolean DEBUG_LIMIT_COUNTRIES = getBooleanProperty("DEBUG_LIMIT_COUNTRIES", false);
public static final String DEBUG_COUNTRY_NAME = getProperty("DEBUG_COUNTRY_NAME", "United States of America");
public static final String GAMS_COUNTRY_TO_SAVE = getProperty("GAMS_COUNTRY_TO_SAVE", "China");;
public static final double PASTURE_MAX_IRRIGATION_RATE = getDoubleProperty("DEFAULT_MAX_IRRIGATION_RATE", 50.0); // shouldn't need this but some areas crops don't have a value, but was causing them to be selected
public static final int LPJG_TIMESTEP_SIZE = 5;
......
......@@ -8,6 +8,9 @@ import java.io.FileWriter;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
......@@ -158,17 +161,17 @@ public class ModelMain {
continue;
}
// some hacky code for debug purposes that keeps each gams gdx file
/* if (ca.getCountry().getName().equals("Spain")) {
// some hacky code for debug purposes that keeps each gams gdx file for one country
if (ModelConfig.GAMS_COUNTRY_TO_SAVE != null & ca.getCountry().getName().equals(ModelConfig.GAMS_COUNTRY_TO_SAVE)) {
try {
Files.copy(
FileSystems.getDefault().getPath("/Users/peteralexander/Documents/R_Workspace/UNPLUM/temp/GamsTmp/_gams_java_gdb1.gdx"),
FileSystems.getDefault().getPath("/Users/peteralexander/Documents/R_Workspace/UNPLUM/temp/GamsTmp/" + timestep.getTimestep() + ".gdx")
FileSystems.getDefault().getPath(ModelConfig.TEMP_DIR + File.separator + "_gams_java_gdb1.gdx"),
FileSystems.getDefault().getPath(ModelConfig.TEMP_DIR + File.separator + ModelConfig.GAMS_COUNTRY_TO_SAVE + timestep.getYear() + ".gdx")
, StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
LogWriter.printException(e);
LogWriter.print(e);
}
} */
}
// update global rasters
globalLandUseRaster.putAll(result.getLandUses());
......
......@@ -119,18 +119,17 @@ 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
prevFertI = defaultI;
prevIrrigI = defaultI;
prevOtherI = defaultI;
prevFertI = CropType.PASTURE.equals(cropType) ? 0.0 : 0.5;
prevIrrigI = CropType.PASTURE.equals(cropType) ? 0.0 : 0.5;
prevOtherI = CropType.PASTURE.equals(cropType) ? 0.1 : 0.5;
}
else {
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;
if (prevOtherI == 0 & !CropType.PASTURE.equals(cropType)) { // 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 = 0.5;
prevIrrigI = 0.5;
}
else {
prevFertI = intensity.getFertiliserIntensity();
......
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