Skip to content
Snippets Groups Projects
Commit 1777708b authored by R0slyn's avatar R0slyn
Browse files

tweak to only output traded crops for crafty

parent d897f009
No related branches found
No related tags found
No related merge requests found
...@@ -321,23 +321,21 @@ private void writeCraftyPricesFile(Timestep timestep){ ...@@ -321,23 +321,21 @@ private void writeCraftyPricesFile(Timestep timestep){
StringBuffer sbHeadings = new StringBuffer("Year, Country, Crop,Import_price, Export_price"); StringBuffer sbHeadings = new StringBuffer("Year, Country, Crop,Import_price, Export_price");
BufferedWriter outputFile = getFileWriter(timestep, ModelConfig.CRAFTY_PRICES_FILE, sbHeadings.toString()); BufferedWriter outputFile = getFileWriter(timestep, ModelConfig.CRAFTY_PRICES_FILE, sbHeadings.toString());
for (CropType crop : CropType.getAllItems()) { for (CountryAgent country : countryAgents) {
for (CountryAgent country : countryAgents) {
Map<CropType, CountryPrice> currentPrices = country.getCurrentCountryPrices();
for (CropType crop : CropType.getImportedTypes()) {
Map<CropType, CropUsageData> cropUsageAllCrops = country.getCropUsageData(); Map<CropType, CropUsageData> cropUsageAllCrops = country.getCropUsageData();
CropUsageData cropUsage = cropUsageAllCrops.get(crop); CropUsageData cropUsage = cropUsageAllCrops.get(crop);
if (cropUsage == null) if (cropUsage == null)
continue; continue;
Double importPrice = null;
Double exportPrice = null;
if (crop.isImportedCrop()) { CountryPrice px = currentPrices.get(crop);
CountryPrice px = country.getCurrentCountryPrices().get(crop); double importPrice = px.getImportPrice();
importPrice = px.getImportPrice(); double exportPrice = px.getExportPrice();
exportPrice = px.getExportPrice();
}
StringBuffer sbData = new StringBuffer(); StringBuffer sbData = new StringBuffer();
sbData.append(String.format("%d,%s,%s", timestep.getYear(), country.getCountry(), crop.getGamsName())); sbData.append(String.format("%d,%s,%s", timestep.getYear(), country.getCountry(), crop.getGamsName()));
......
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