From f9dd6d4731e643402ecd2ce9b2e2ee0d9b93ff56 Mon Sep 17 00:00:00 2001 From: s1924442 <b.arendarczyk@sms.ed.ac.uk> Date: Wed, 7 Apr 2021 20:32:16 +0100 Subject: [PATCH] Added ForestManager class. --- src/ac/ed/lurg/ModelMain.java | 4 +- src/ac/ed/lurg/country/ForestManager.java | 130 ++++++++++++++++++ src/ac/ed/lurg/country/ForestRecord.java | 60 ++++++++ .../country/gams/GamsLocationOptimiser.java | 30 ++-- .../lurg/country/gams/GamsLocationOutput.java | 12 +- .../country/gams/GamsRasterOptimiser.java | 37 +++-- .../lurg/country/gams/GamsRasterOutput.java | 12 +- src/ac/ed/lurg/landuse/CarbonFluxReader.java | 64 ++++----- src/ac/ed/lurg/landuse/LandCoverReader.java | 3 +- src/ac/ed/lurg/landuse/LandUseItem.java | 4 +- src/ac/ed/lurg/landuse/WoodYieldReader.java | 24 +--- src/ac/ed/lurg/output/LpjgOutputer.java | 7 +- src/ac/ed/lurg/types/LandCoverType.java | 19 ++- 13 files changed, 292 insertions(+), 114 deletions(-) create mode 100644 src/ac/ed/lurg/country/ForestManager.java create mode 100644 src/ac/ed/lurg/country/ForestRecord.java diff --git a/src/ac/ed/lurg/ModelMain.java b/src/ac/ed/lurg/ModelMain.java index 91402619..b7c6de37 100644 --- a/src/ac/ed/lurg/ModelMain.java +++ b/src/ac/ed/lurg/ModelMain.java @@ -178,8 +178,8 @@ public class ModelMain { sbData.append(String.format("%d,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f", timestep.getYear(), LandUseItem.getTotalLandCover(landUseRaster.values(), LandCoverType.CROPLAND), LandUseItem.getTotalLandCover(landUseRaster.values(), LandCoverType.PASTURE), - LandUseItem.getTotalLandCover(landUseRaster.values(), LandCoverType.TIMBER_FOREST) + LandUseItem.getTotalLandCover(landUseRaster.values(), LandCoverType.CARBON_FOREST), - LandUseItem.getTotalLandCover(landUseRaster.values(), LandCoverType.UNMANAGED_FOREST), + LandUseItem.getTotalLandCover(landUseRaster.values(), LandCoverType.TIMBER_FOREST), + LandUseItem.getTotalLandCover(landUseRaster.values(), LandCoverType.CARBON_FOREST), LandUseItem.getTotalLandCover(landUseRaster.values(), LandCoverType.OTHER_NATURAL), LandUseItem.getAbandonedPasture(landUseRaster.values()), LandUseItem.getSuitableTotal(landUseRaster.values(), timestep.getYear())) diff --git a/src/ac/ed/lurg/country/ForestManager.java b/src/ac/ed/lurg/country/ForestManager.java new file mode 100644 index 00000000..da57601d --- /dev/null +++ b/src/ac/ed/lurg/country/ForestManager.java @@ -0,0 +1,130 @@ +package ac.ed.lurg.country; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; + +import ac.ed.lurg.ModelConfig; +import ac.ed.lurg.Timestep; +import ac.ed.lurg.types.LandCoverType; +import ac.ed.lurg.utils.DoubleMap; +import ac.ed.lurg.utils.LogWriter; + +public class ForestManager { + private List<ForestRecord> forestHistory; + + ForestManager() { + forestHistory = new ArrayList<ForestRecord>(); + } + + public List<ForestRecord> getReservedAreaForTimestep(Timestep timestep) { + List<ForestRecord> minimumLandCoverForTimestep = new ArrayList<ForestRecord>(); + double minYear = timestep.getYear() - ModelConfig.FOREST_LOCKIN_PERIOD; + for (ForestRecord forestRecord : forestHistory) { + if (forestRecord.getYearPlanted() > minYear) { + minimumLandCoverForTimestep.add(forestRecord); + } + } + + return minimumLandCoverForTimestep; + } + + public double getForestPlantedArea(int year, int location, LandCoverType forestType) { + List<ForestRecord> recordsFound = forestHistory + .stream() + .filter(r -> r.getYearPlanted() == year && r.getLocation() == location) + .collect(Collectors.toList()); + + if (recordsFound.size() > 1) + LogWriter.printlnError("ForestManager.getForestPlantedArea(): duplicate records found."); + + if (recordsFound.isEmpty()) + return 0.0; + + return recordsFound.get(0).getArea(forestType); + } + + public void setForestPlantedArea(int year, int location, LandCoverType forestType, double area) { + List<ForestRecord> recordsFound = forestHistory + .stream() + .filter(r -> r.getYearPlanted() == year && r.getLocation() == location) + .collect(Collectors.toList()); + + if (recordsFound.size() > 1) + LogWriter.printlnError("ForestManager.getForestPlantedArea(): duplicate records found."); + + if (recordsFound.isEmpty()) + LogWriter.printlnError("ForestManager.getForestPlantedArea(): no records found."); + + recordsFound.get(0).setArea(forestType, area); + } + + public double getPotentialYield(int year, int location, LandCoverType forestType) { + List<ForestRecord> recordsFound = forestHistory + .stream() + .filter(r -> r.getYearPlanted() == year && r.getLocation() == location) + .collect(Collectors.toList()); + + if (recordsFound.size() > 1) + LogWriter.printlnError("ForestManager.getPotentialYield(): duplicate records found."); + + if (recordsFound.isEmpty()) + LogWriter.printlnError("ForestManager.getPotentialYield(): no records found."); + + return recordsFound.get(0).getPotentialYield(forestType); + } + + public void updateForestHistory(List<ForestRecord> newForest, DoubleMap<Integer, LandCoverType, Double> reservedDeforested, Timestep timestep) { + int yearPlanted = timestep.getYear(); + for (ForestRecord item : newForest) { + forestHistory.add(new ForestRecord(yearPlanted, item)); + } + + // Remove deforested area from minimum area requirement + if (reservedDeforested.getMap().isEmpty()) + return; + + for (Entry<Integer, Map<LandCoverType, Double>> locMap : reservedDeforested.getMap().entrySet()) { + int locId = locMap.getKey(); + + for (Entry<LandCoverType, Double> coverMap : locMap.getValue().entrySet()) { + LandCoverType forestType = coverMap.getKey(); + double deforestedArea = coverMap.getValue(); + List<Integer> yearsFound = new ArrayList<Integer>(); + for (ForestRecord item : forestHistory) { + yearsFound.add(item.getYearPlanted()); + } + Collections.sort(yearsFound, Collections.reverseOrder()); // descending order, remove area from newest forest first + int minYear = timestep.getYear() - ModelConfig.FOREST_LOCKIN_PERIOD; + + for (int year : yearsFound) { + if (year > minYear) { + double currentArea = getForestPlantedArea(year, locId, forestType); + if (currentArea < 0.0) + LogWriter.printlnError("ForestManager.updateForestHistory(): currentMinimumArea < 0"); + else if (currentArea == 0.0) { + continue; + } + + double areaToSubtract = Math.min(currentArea, deforestedArea); + if (currentArea - areaToSubtract < 0.0) { // floating point errors + areaToSubtract = currentArea; + } + + setForestPlantedArea(year, locId, forestType, currentArea - areaToSubtract); + deforestedArea -= areaToSubtract; + if (deforestedArea < 1E-6) + break; + } + } + + if (deforestedArea >= 1E-6) + LogWriter.printlnError("ForestManager.updateForestHistory(): unable to subtract all deforested area"); + } + } + } + +} diff --git a/src/ac/ed/lurg/country/ForestRecord.java b/src/ac/ed/lurg/country/ForestRecord.java new file mode 100644 index 00000000..f298c595 --- /dev/null +++ b/src/ac/ed/lurg/country/ForestRecord.java @@ -0,0 +1,60 @@ +package ac.ed.lurg.country; + +import java.util.Map; + +import ac.ed.lurg.types.LandCoverType; + +public class ForestRecord { + private int yearPlanted; + private int location; + private Map<LandCoverType, Double> area; + private Map<LandCoverType, Double> potentialYield; + + public ForestRecord() {} + + public ForestRecord(int yearPlanted, int location, LandCoverType forestType, Map<LandCoverType, Double> area, Map<LandCoverType, Double> potentialYield) { + this.yearPlanted = yearPlanted; + this.location = location; + this.area = area; + this.potentialYield = potentialYield; + } + + public ForestRecord(int location, Map<LandCoverType, Double> area, Map<LandCoverType, Double> potentialYield) { + this.location = location; + this.area = area; + this.potentialYield = potentialYield; + } + + public ForestRecord(int yearPlanted, ForestRecord forestRecordToCopy) { + this(); + this.yearPlanted = yearPlanted; + location = (forestRecordToCopy.location); + area.putAll(forestRecordToCopy.area); + potentialYield.putAll(forestRecordToCopy.potentialYield); + } + + public int getYearPlanted() { + return yearPlanted; + } + + public void setYearPlanted(int yearPlanted) { + this.yearPlanted = yearPlanted; + } + + public int getLocation() { + return location; + } + + public double getArea(LandCoverType forestType) { + return area.get(forestType); + } + + + public void setArea(LandCoverType forestType, double area) { + this.area.put(forestType, area); + } + + public double getPotentialYield(LandCoverType forestType) { + return potentialYield.get(forestType); + } +} diff --git a/src/ac/ed/lurg/country/gams/GamsLocationOptimiser.java b/src/ac/ed/lurg/country/gams/GamsLocationOptimiser.java index b778ff89..fd47b613 100644 --- a/src/ac/ed/lurg/country/gams/GamsLocationOptimiser.java +++ b/src/ac/ed/lurg/country/gams/GamsLocationOptimiser.java @@ -1,7 +1,9 @@ package ac.ed.lurg.country.gams; import java.io.File; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Vector; @@ -22,6 +24,7 @@ import com.gams.api.GAMSWorkspaceInfo; import ac.ed.lurg.ModelConfig; import ac.ed.lurg.country.CountryPrice; +import ac.ed.lurg.country.ForestRecord; import ac.ed.lurg.country.TradeConstraint; import ac.ed.lurg.landuse.CarbonFluxItem; import ac.ed.lurg.landuse.ConversionCostReader; @@ -559,28 +562,27 @@ public class GamsLocationOptimiser { if (!fromLC.equals(toLC)) { //Important as don't want to include unchanged land cover landCoverChanges.put(locId, LandCoverType.getForName(fromLC), LandCoverType.getForName(toLC), change); - } - + } } // Minimum land cover additions. Need to keep track of new forest areas to restrict conversion - DoubleMap<Integer, LandCoverType, Double> minimumLandCoverAdditions = new DoubleMap<Integer, LandCoverType, Double>(); - + List<ForestRecord> newForest = new ArrayList<ForestRecord>(); + for (Entry<Integer, DoubleMap<LandCoverType, LandCoverType, Double>> locMap : landCoverChanges.getMap().entrySet()) { Integer locId = locMap.getKey(); DoubleMap<LandCoverType, LandCoverType, Double> changeMap = locMap.getValue(); for (LandCoverType fromLC : LandCoverType.getConvertibleTypes()) { - if (fromLC != LandCoverType.TIMBER_FOREST) //exclude unchanged forest - minimumLandCoverAdditions.addTo(locId, LandCoverType.TIMBER_FOREST, changeMap.get(fromLC, LandCoverType.TIMBER_FOREST)); - if (fromLC != LandCoverType.CARBON_FOREST) - minimumLandCoverAdditions.addTo(locId, LandCoverType.CARBON_FOREST, changeMap.get(fromLC, LandCoverType.CARBON_FOREST)); - /* - if (fromLC != LandCoverType.UNMANAGED_FOREST) - minimumLandCoverAdditions.addTo(locId, LandCoverType.UNMANAGED_FOREST, changeMap.get(fromLC, LandCoverType.UNMANAGED_FOREST)); - */ - } + for (LandCoverType toLC : LandCoverType.getManagedForestTypes()) { + Double minArea = inputData.getMinimumLandCover().get(locId, fromLC); + minArea = (minArea == null) ? 0.0 : minArea; + double newForestArea = changeMap.get(fromLC, toLC) - inputData.getMinimumLandCover().get(locId, fromLC); + double woodYield = inputData.getWoodYields().get(locId).getWoodYield(fromLC, toLC); + newForest.add(new ForestRecord(locId, toLC, newForestArea, woodYield)); + } + } } + // reserved Forest which was deforested GAMSVariable varReservedDeforested = outDB.getVariable("reservedAreaDeforested"); DoubleMap<Integer, LandCoverType, Double> reservedDeforested = new DoubleMap<Integer, LandCoverType, Double>(); @@ -600,7 +602,7 @@ public class GamsLocationOptimiser { // Carbon flux double netCarbonFlux = outDB.getParameter("netCarbonFlux").getFirstRecord().getValue(); - GamsLocationOutput results = new GamsLocationOutput(modelStatus, landUses, cropUsageData, landCoverChanges, minimumLandCoverAdditions, reservedDeforested, netCarbonFlux); + GamsLocationOutput results = new GamsLocationOutput(modelStatus, landUses, cropUsageData, landCoverChanges, newForest, reservedDeforested, netCarbonFlux); return results; } diff --git a/src/ac/ed/lurg/country/gams/GamsLocationOutput.java b/src/ac/ed/lurg/country/gams/GamsLocationOutput.java index 7d579e79..5cd4ad93 100644 --- a/src/ac/ed/lurg/country/gams/GamsLocationOutput.java +++ b/src/ac/ed/lurg/country/gams/GamsLocationOutput.java @@ -1,5 +1,6 @@ package ac.ed.lurg.country.gams; +import java.util.List; import java.util.Map; import com.gams.api.GAMSGlobals.ModelStat; @@ -10,6 +11,7 @@ import ac.ed.lurg.types.CropType; import ac.ed.lurg.utils.DoubleMap; import ac.ed.lurg.utils.TripleMap; import ac.ed.lurg.types.LandCoverType; +import ac.ed.lurg.country.ForestRecord; public class GamsLocationOutput { ModelStat status; @@ -17,7 +19,7 @@ public class GamsLocationOutput { Map<Integer, LandUseItem> landUses; // data mapped from id (not raster) private Map<CropType, CropUsageData> cropUsageData; TripleMap<Integer, LandCoverType, LandCoverType, Double> landCoverChanges; - DoubleMap<Integer, LandCoverType, Double> minimumLandCover; + List<ForestRecord> newForest; DoubleMap<Integer, LandCoverType, Double> reservedDeforested; double netCarbonFlux; @@ -25,7 +27,7 @@ public class GamsLocationOutput { Map<Integer, LandUseItem> landUses, Map<CropType, CropUsageData> cropUsageData, TripleMap<Integer, LandCoverType, LandCoverType, Double> landCoverChange, - DoubleMap<Integer, LandCoverType, Double> minimumLandCover, + List<ForestRecord> newForest, DoubleMap<Integer, LandCoverType, Double> reservedDeforested, double netCarbonFlux) { super(); @@ -33,7 +35,7 @@ public class GamsLocationOutput { this.landUses = landUses; this.cropUsageData = cropUsageData; this.landCoverChanges = landCoverChange; - this.minimumLandCover = minimumLandCover; + this.newForest = newForest; this.reservedDeforested = reservedDeforested; this.netCarbonFlux = netCarbonFlux; } @@ -53,8 +55,8 @@ public class GamsLocationOutput { return landCoverChanges; } - public DoubleMap<Integer, LandCoverType, Double> getMinimumLandCover() { - return minimumLandCover; + public List<ForestRecord> getNewForest() { + return newForest; } public DoubleMap<Integer, LandCoverType, Double> getReservedDeforested() { diff --git a/src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java b/src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java index 8afd9b65..7641342a 100644 --- a/src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java +++ b/src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java @@ -53,7 +53,7 @@ public class GamsRasterOptimiser { private GamsRasterOutput convertToRaster(GamsLocationInput gamsInput, GamsLocationOutput gamsOutput) { RasterSet<LandUseItem> newIntensityRaster = allocAreas(gamsInput.getPreviousLandUse(), gamsOutput, gamsInput.getTimestep().getYear()); - return new GamsRasterOutput(gamsOutput.getStatus(), newIntensityRaster, gamsOutput.getCommoditiesData(), gamsOutput.getMinimumLandCover(), gamsOutput.getReservedDeforested(), gamsOutput.netCarbonFlux); + return new GamsRasterOutput(gamsOutput.getStatus(), newIntensityRaster, gamsOutput.getCommoditiesData(), gamsOutput.getNewForest(), gamsOutput.getReservedDeforested(), gamsOutput.netCarbonFlux); } private RasterSet<LandUseItem> createWithSameLandCovers(RasterSet<LandUseItem> toCopy) { @@ -286,26 +286,35 @@ public class GamsRasterOptimiser { //LogWriter.println(id + ", " + key + ", " + avgIrigCost.getIrrigCost() + ", from " + areaSoFar + ", " + suitableAreaThisTime + ", " + irrigCost.getIrrigCost()); } + /* + if (carbonFluxItem == null) { + LogWriter.println("" + rasterInputData.getCarbonFluxes().getXCoordin(key)); + LogWriter.println("" + rasterInputData.getCarbonFluxes().getYCoordin(key)); + } + */ + // Aggregate carbon fluxes and wood yields for (LandCoverType prevLC : LandCoverType.getConvertibleTypes()) { for (LandCoverType newLC : LandCoverType.getConvertibleTypes()) { - // Carbon flux - if (!aggCFlux.checkForKeys(prevLC, newLC)) { // if not seen yet - aggCFlux.setCarbonFlux(prevLC, newLC, carbonFluxItem.getCarbonFlux(prevLC, newLC)); - } else { - aggCFlux.setCarbonFlux(prevLC, newLC, aggregateMean(aggCFlux.getCarbonFlux(prevLC, newLC), suitableAreaSoFar, - carbonFluxItem.getCarbonFlux(prevLC, newLC), suitableAreaThisTime)); + if (carbonFluxItem != null) { + if (!aggCFlux.checkForKeys(prevLC, newLC)) { // if not seen yet + aggCFlux.setCarbonFlux(prevLC, newLC, carbonFluxItem.getCarbonFlux(prevLC, newLC)); + } else { + aggCFlux.setCarbonFlux(prevLC, newLC, aggregateMean(aggCFlux.getCarbonFlux(prevLC, newLC), suitableAreaSoFar, + carbonFluxItem.getCarbonFlux(prevLC, newLC), suitableAreaThisTime)); + } } - + // Wood yield - if (!aggWYield.checkForKeys(prevLC, newLC)) { // if not seen yet - aggWYield.setWoodYield(prevLC, newLC, woodYieldItem.getWoodYield(prevLC, newLC)); - } else { - aggWYield.setWoodYield(prevLC, newLC, aggregateMean(aggWYield.getWoodYield(prevLC, newLC), suitableAreaSoFar, - woodYieldItem.getWoodYield(prevLC, newLC), suitableAreaThisTime)); + if (woodYieldItem != null) { + if (!aggWYield.checkForKeys(prevLC, newLC)) { // if not seen yet + aggWYield.setWoodYield(prevLC, newLC, woodYieldItem.getWoodYield(prevLC, newLC)); + } else { + aggWYield.setWoodYield(prevLC, newLC, aggregateMean(aggWYield.getWoodYield(prevLC, newLC), suitableAreaSoFar, + woodYieldItem.getWoodYield(prevLC, newLC), suitableAreaThisTime)); + } } - } } diff --git a/src/ac/ed/lurg/country/gams/GamsRasterOutput.java b/src/ac/ed/lurg/country/gams/GamsRasterOutput.java index c16a6b80..110bb241 100644 --- a/src/ac/ed/lurg/country/gams/GamsRasterOutput.java +++ b/src/ac/ed/lurg/country/gams/GamsRasterOutput.java @@ -1,9 +1,11 @@ package ac.ed.lurg.country.gams; +import java.util.List; import java.util.Map; import com.gams.api.GAMSGlobals.ModelStat; +import ac.ed.lurg.country.ForestRecord; import ac.ed.lurg.landuse.CropUsageData; import ac.ed.lurg.landuse.LandUseItem; import ac.ed.lurg.types.CropType; @@ -16,7 +18,7 @@ public class GamsRasterOutput { private ModelStat status; private RasterSet<LandUseItem> landUses; private Map<CropType, CropUsageData> cropUsageData; - private DoubleMap<Integer, LandCoverType, Double> minimumLandCoverAdditions; + private List<ForestRecord> newForest; DoubleMap<Integer, LandCoverType, Double> reservedDeforested; double netCarbonFlux; @@ -27,11 +29,11 @@ public class GamsRasterOutput { } public GamsRasterOutput(ModelStat status, RasterSet<LandUseItem> intensityRaster, Map<CropType, CropUsageData> cropUsageData, - DoubleMap<Integer, LandCoverType, Double> minimumLandCoverAdditions, DoubleMap<Integer, LandCoverType, Double> reservedDeforested, + List<ForestRecord> newForest, DoubleMap<Integer, LandCoverType, Double> reservedDeforested, double netCarbonFlux) { this(intensityRaster, cropUsageData); this.status = status; - this.minimumLandCoverAdditions = minimumLandCoverAdditions; + this.newForest = newForest; this.reservedDeforested = reservedDeforested; this.netCarbonFlux = netCarbonFlux; } @@ -48,8 +50,8 @@ public class GamsRasterOutput { return cropUsageData; } - public DoubleMap<Integer, LandCoverType, Double> getMinimumLandCoverAdditions() { - return minimumLandCoverAdditions; + public List<ForestRecord> getNewForest() { + return newForest; } public DoubleMap<Integer, LandCoverType, Double> getReservedDeforested() { diff --git a/src/ac/ed/lurg/landuse/CarbonFluxReader.java b/src/ac/ed/lurg/landuse/CarbonFluxReader.java index 29014937..1cd1386f 100644 --- a/src/ac/ed/lurg/landuse/CarbonFluxReader.java +++ b/src/ac/ed/lurg/landuse/CarbonFluxReader.java @@ -10,7 +10,7 @@ import ac.sac.raster.RasterSet; public class CarbonFluxReader extends AbstractTabularRasterReader<CarbonFluxItem> { private static final int MIN_COLS = 27; - private static final double conversionFactor = 10; // convert kgC/m2 to MtC/Mha + private static final double CONVERSION_FACTOR = 10; // convert kgC/m2 to tC/ha public CarbonFluxReader(RasterSet<CarbonFluxItem> carbonFluxes) { super("[ |\t]+", MIN_COLS, carbonFluxes); @@ -18,47 +18,35 @@ public class CarbonFluxReader extends AbstractTabularRasterReader<CarbonFluxItem @Override protected void setData(RasterKey key, CarbonFluxItem item, Map<String, Double> rowValues) { - item.setCarbonFlux(LandCoverType.CROPLAND, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "crop_to_ntrl") * conversionFactor); - item.setCarbonFlux(LandCoverType.CROPLAND, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "crop_to_forT") * conversionFactor); - item.setCarbonFlux(LandCoverType.CROPLAND, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "crop_to_forC") * conversionFactor); - item.setCarbonFlux(LandCoverType.CROPLAND, LandCoverType.UNMANAGED_FOREST, getValueForCol(rowValues, "crop_to_ntrl") * conversionFactor); - item.setCarbonFlux(LandCoverType.CROPLAND, LandCoverType.PASTURE, getValueForCol(rowValues, "crop_to_past") * conversionFactor); - item.setCarbonFlux(LandCoverType.CROPLAND, LandCoverType.CROPLAND, getValueForCol(rowValues, "crop_to_crop") * conversionFactor); + item.setCarbonFlux(LandCoverType.CROPLAND, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "crop_to_ntrl") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.CROPLAND, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "crop_to_forT") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.CROPLAND, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "crop_to_forC") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.CROPLAND, LandCoverType.PASTURE, getValueForCol(rowValues, "crop_to_past") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.CROPLAND, LandCoverType.CROPLAND, getValueForCol(rowValues, "crop_to_crop") * CONVERSION_FACTOR); - item.setCarbonFlux(LandCoverType.PASTURE, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "past_to_ntrl") * conversionFactor); - item.setCarbonFlux(LandCoverType.PASTURE, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "past_to_forT") * conversionFactor); - item.setCarbonFlux(LandCoverType.PASTURE, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "past_to_forC") * conversionFactor); - item.setCarbonFlux(LandCoverType.PASTURE, LandCoverType.UNMANAGED_FOREST, getValueForCol(rowValues, "past_to_ntrl") * conversionFactor); - item.setCarbonFlux(LandCoverType.PASTURE, LandCoverType.CROPLAND, getValueForCol(rowValues, "past_to_crop") * conversionFactor); - item.setCarbonFlux(LandCoverType.PASTURE, LandCoverType.PASTURE, getValueForCol(rowValues, "past_to_past") * conversionFactor); + item.setCarbonFlux(LandCoverType.PASTURE, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "past_to_ntrl") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.PASTURE, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "past_to_forT") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.PASTURE, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "past_to_forC") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.PASTURE, LandCoverType.CROPLAND, getValueForCol(rowValues, "past_to_crop") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.PASTURE, LandCoverType.PASTURE, getValueForCol(rowValues, "past_to_past") * CONVERSION_FACTOR); - item.setCarbonFlux(LandCoverType.OTHER_NATURAL, LandCoverType.PASTURE, getValueForCol(rowValues, "ntrl_to_past") * conversionFactor); - item.setCarbonFlux(LandCoverType.OTHER_NATURAL, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "ntrl_to_forT") * conversionFactor); - item.setCarbonFlux(LandCoverType.OTHER_NATURAL, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "ntrl_to_forC") * conversionFactor); - item.setCarbonFlux(LandCoverType.OTHER_NATURAL, LandCoverType.UNMANAGED_FOREST, getValueForCol(rowValues, "ntrl_to_ntrl") * conversionFactor); - item.setCarbonFlux(LandCoverType.OTHER_NATURAL, LandCoverType.CROPLAND, getValueForCol(rowValues, "ntrl_to_crop") * conversionFactor); - item.setCarbonFlux(LandCoverType.OTHER_NATURAL, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "ntrl_to_ntrl") * conversionFactor); + item.setCarbonFlux(LandCoverType.OTHER_NATURAL, LandCoverType.PASTURE, getValueForCol(rowValues, "ntrl_to_past") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.OTHER_NATURAL, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "ntrl_to_forT") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.OTHER_NATURAL, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "ntrl_to_forC") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.OTHER_NATURAL, LandCoverType.CROPLAND, getValueForCol(rowValues, "ntrl_to_crop") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.OTHER_NATURAL, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "ntrl_to_ntrl") * CONVERSION_FACTOR); - item.setCarbonFlux(LandCoverType.TIMBER_FOREST, LandCoverType.PASTURE, getValueForCol(rowValues, "forT_to_past") * conversionFactor); - item.setCarbonFlux(LandCoverType.TIMBER_FOREST, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "forT_to_ntrl") * conversionFactor); - item.setCarbonFlux(LandCoverType.TIMBER_FOREST, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "forT_to_forC") * conversionFactor); - item.setCarbonFlux(LandCoverType.TIMBER_FOREST, LandCoverType.UNMANAGED_FOREST, getValueForCol(rowValues, "forT_to_ntrl") * conversionFactor); - item.setCarbonFlux(LandCoverType.TIMBER_FOREST, LandCoverType.CROPLAND, getValueForCol(rowValues, "forT_to_crop") * conversionFactor); - item.setCarbonFlux(LandCoverType.TIMBER_FOREST, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "forT_to_forT") * conversionFactor); + item.setCarbonFlux(LandCoverType.TIMBER_FOREST, LandCoverType.PASTURE, getValueForCol(rowValues, "forT_to_past") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.TIMBER_FOREST, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "forT_to_ntrl") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.TIMBER_FOREST, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "forT_to_forC") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.TIMBER_FOREST, LandCoverType.CROPLAND, getValueForCol(rowValues, "forT_to_crop") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.TIMBER_FOREST, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "forT_to_forT") * CONVERSION_FACTOR); - item.setCarbonFlux(LandCoverType.CARBON_FOREST, LandCoverType.PASTURE, getValueForCol(rowValues, "forC_to_past") * conversionFactor); - item.setCarbonFlux(LandCoverType.CARBON_FOREST, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "forC_to_ntrl") * conversionFactor); - item.setCarbonFlux(LandCoverType.CARBON_FOREST, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "forC_to_forT") * conversionFactor); - item.setCarbonFlux(LandCoverType.CARBON_FOREST, LandCoverType.UNMANAGED_FOREST, getValueForCol(rowValues, "forC_to_ntrl") * conversionFactor); - item.setCarbonFlux(LandCoverType.CARBON_FOREST, LandCoverType.CROPLAND, getValueForCol(rowValues, "forC_to_crop") * conversionFactor); - item.setCarbonFlux(LandCoverType.CARBON_FOREST, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "forC_to_forC") * conversionFactor); - - item.setCarbonFlux(LandCoverType.UNMANAGED_FOREST, LandCoverType.PASTURE, getValueForCol(rowValues, "ntrl_to_past") * conversionFactor); - item.setCarbonFlux(LandCoverType.UNMANAGED_FOREST, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "ntrl_to_forT") * conversionFactor); - item.setCarbonFlux(LandCoverType.UNMANAGED_FOREST, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "ntrl_to_forC") * conversionFactor); - item.setCarbonFlux(LandCoverType.UNMANAGED_FOREST, LandCoverType.UNMANAGED_FOREST, getValueForCol(rowValues, "ntrl_to_ntrl") * conversionFactor); - item.setCarbonFlux(LandCoverType.UNMANAGED_FOREST, LandCoverType.CROPLAND, getValueForCol(rowValues, "ntrl_to_crop") * conversionFactor); - item.setCarbonFlux(LandCoverType.UNMANAGED_FOREST, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "ntrl_to_ntrl") * conversionFactor); + item.setCarbonFlux(LandCoverType.CARBON_FOREST, LandCoverType.PASTURE, getValueForCol(rowValues, "forC_to_past") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.CARBON_FOREST, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "forC_to_ntrl") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.CARBON_FOREST, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "forC_to_forT") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.CARBON_FOREST, LandCoverType.CROPLAND, getValueForCol(rowValues, "forC_to_crop") * CONVERSION_FACTOR); + item.setCarbonFlux(LandCoverType.CARBON_FOREST, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "forC_to_forC") * CONVERSION_FACTOR); } diff --git a/src/ac/ed/lurg/landuse/LandCoverReader.java b/src/ac/ed/lurg/landuse/LandCoverReader.java index 66bbfc5c..67732b65 100644 --- a/src/ac/ed/lurg/landuse/LandCoverReader.java +++ b/src/ac/ed/lurg/landuse/LandCoverReader.java @@ -22,10 +22,9 @@ public class LandCoverReader extends AbstractTabularRasterReader<LandCoverItem> lcData.setTotalArea(dataset.getAreaMha(key)); lcData.setLandCoverFract(LandCoverType.CROPLAND, getValueForCol(rowValues, "cropland")); lcData.setLandCoverFract(LandCoverType.PASTURE, getValueForCol(rowValues, "pasture")); - lcData.setLandCoverFract(LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "natural")); + lcData.setLandCoverFract(LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "natural") + getValueForCol(rowValues, "unmanaged_forest")); lcData.setLandCoverFract(LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "managed_forest")); lcData.setLandCoverFract(LandCoverType.CARBON_FOREST, 0.0); // TODO custom initial timber/carbon forest allocation - lcData.setLandCoverFract(LandCoverType.UNMANAGED_FOREST, getValueForCol(rowValues, "unmanaged_forest")); lcData.setLandCoverFract(LandCoverType.BARREN, getValueForCol(rowValues, "barren")); lcData.setLandCoverFract(LandCoverType.URBAN, getValueForCol(rowValues, "urban")); } diff --git a/src/ac/ed/lurg/landuse/LandUseItem.java b/src/ac/ed/lurg/landuse/LandUseItem.java index 56ca4334..241b14d5 100644 --- a/src/ac/ed/lurg/landuse/LandUseItem.java +++ b/src/ac/ed/lurg/landuse/LandUseItem.java @@ -305,7 +305,7 @@ public class LandUseItem implements InterpolatingRasterItem<LandUseItem>, Serial } public double getTotalNatural() { - double totalNatural = getLandCoverArea(LandCoverType.OTHER_NATURAL) + getLandCoverArea(LandCoverType.UNMANAGED_FOREST); + double totalNatural = getLandCoverArea(LandCoverType.OTHER_NATURAL); return totalNatural; } @@ -378,12 +378,14 @@ public class LandUseItem implements InterpolatingRasterItem<LandUseItem>, Serial suitableArea = currentAgri + getTotalUnprotectedNatural(); } + /* public double getForestManagedFraction() { double managed = getLandCoverArea(LandCoverType.TIMBER_FOREST) + getLandCoverArea(LandCoverType.CARBON_FOREST); double unmanaged = getLandCoverArea(LandCoverType.UNMANAGED_FOREST); double d = managed / (managed + unmanaged); return (Double.isNaN(d) || Double.isInfinite(d)) ? 1.0 : d; } + */ public CropToDouble getCropChanges(LandUseItem prevAreaAggItem) { CropToDouble changes = new CropToDouble(); diff --git a/src/ac/ed/lurg/landuse/WoodYieldReader.java b/src/ac/ed/lurg/landuse/WoodYieldReader.java index f775fc14..bc231db3 100644 --- a/src/ac/ed/lurg/landuse/WoodYieldReader.java +++ b/src/ac/ed/lurg/landuse/WoodYieldReader.java @@ -20,43 +20,31 @@ public class WoodYieldReader extends AbstractTabularRasterReader<WoodYieldItem> item.setWoodYield(LandCoverType.CROPLAND, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "crop_to_ntrl") * conversionFactor); item.setWoodYield(LandCoverType.CROPLAND, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "crop_to_forT") * conversionFactor); item.setWoodYield(LandCoverType.CROPLAND, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "crop_to_forC") * conversionFactor); - item.setWoodYield(LandCoverType.CROPLAND, LandCoverType.UNMANAGED_FOREST, getValueForCol(rowValues, "crop_to_ntrl") * conversionFactor); item.setWoodYield(LandCoverType.CROPLAND, LandCoverType.PASTURE, getValueForCol(rowValues, "crop_to_past") * conversionFactor); item.setWoodYield(LandCoverType.CROPLAND, LandCoverType.CROPLAND, getValueForCol(rowValues, "crop_to_crop") * conversionFactor); item.setWoodYield(LandCoverType.PASTURE, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "past_to_ntrl") * conversionFactor); item.setWoodYield(LandCoverType.PASTURE, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "past_to_forT") * conversionFactor); item.setWoodYield(LandCoverType.PASTURE, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "past_to_forC") * conversionFactor); - item.setWoodYield(LandCoverType.PASTURE, LandCoverType.UNMANAGED_FOREST, getValueForCol(rowValues, "past_to_ntrl") * conversionFactor); item.setWoodYield(LandCoverType.PASTURE, LandCoverType.CROPLAND, getValueForCol(rowValues, "past_to_crop") * conversionFactor); item.setWoodYield(LandCoverType.PASTURE, LandCoverType.PASTURE, getValueForCol(rowValues, "past_to_past") * conversionFactor); - item.setWoodYield(LandCoverType.OTHER_NATURAL, LandCoverType.PASTURE, 0.0); - item.setWoodYield(LandCoverType.OTHER_NATURAL, LandCoverType.TIMBER_FOREST, 0.0); - item.setWoodYield(LandCoverType.OTHER_NATURAL, LandCoverType.CARBON_FOREST, 0.0); - item.setWoodYield(LandCoverType.OTHER_NATURAL, LandCoverType.UNMANAGED_FOREST, 0.0); - item.setWoodYield(LandCoverType.OTHER_NATURAL, LandCoverType.CROPLAND, 0.0); - item.setWoodYield(LandCoverType.OTHER_NATURAL, LandCoverType.OTHER_NATURAL, 0.0); + item.setWoodYield(LandCoverType.OTHER_NATURAL, LandCoverType.PASTURE, getValueForCol(rowValues, "ntrl_to_past") * conversionFactor); + item.setWoodYield(LandCoverType.OTHER_NATURAL, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "ntrl_to_forT") * conversionFactor); + item.setWoodYield(LandCoverType.OTHER_NATURAL, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "ntrl_to_forC") * conversionFactor); + item.setWoodYield(LandCoverType.OTHER_NATURAL, LandCoverType.CROPLAND, getValueForCol(rowValues, "ntrl_to_crop") * conversionFactor); + item.setWoodYield(LandCoverType.OTHER_NATURAL, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "ntrl_to_ntrl") * conversionFactor); item.setWoodYield(LandCoverType.TIMBER_FOREST, LandCoverType.PASTURE, getValueForCol(rowValues, "forT_to_past") * conversionFactor); item.setWoodYield(LandCoverType.TIMBER_FOREST, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "forT_to_ntrl") * conversionFactor); item.setWoodYield(LandCoverType.TIMBER_FOREST, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "forT_to_forC") * conversionFactor); - item.setWoodYield(LandCoverType.TIMBER_FOREST, LandCoverType.UNMANAGED_FOREST, getValueForCol(rowValues, "forT_to_ntrl") * conversionFactor); item.setWoodYield(LandCoverType.TIMBER_FOREST, LandCoverType.CROPLAND, getValueForCol(rowValues, "forT_to_crop") * conversionFactor); item.setWoodYield(LandCoverType.TIMBER_FOREST, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "forT_to_forT") * conversionFactor); item.setWoodYield(LandCoverType.CARBON_FOREST, LandCoverType.PASTURE, getValueForCol(rowValues, "forC_to_past") * conversionFactor); item.setWoodYield(LandCoverType.CARBON_FOREST, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "forC_to_ntrl") * conversionFactor); item.setWoodYield(LandCoverType.CARBON_FOREST, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "forC_to_forT") * conversionFactor); - item.setWoodYield(LandCoverType.CARBON_FOREST, LandCoverType.UNMANAGED_FOREST, getValueForCol(rowValues, "forC_to_ntrl") * conversionFactor); item.setWoodYield(LandCoverType.CARBON_FOREST, LandCoverType.CROPLAND, getValueForCol(rowValues, "forC_to_crop") * conversionFactor); - item.setWoodYield(LandCoverType.CARBON_FOREST, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "forC_to_forC") * conversionFactor); - - item.setWoodYield(LandCoverType.UNMANAGED_FOREST, LandCoverType.PASTURE, getValueForCol(rowValues, "ntrl_to_past") * conversionFactor); - item.setWoodYield(LandCoverType.UNMANAGED_FOREST, LandCoverType.TIMBER_FOREST, getValueForCol(rowValues, "ntrl_to_forT") * conversionFactor); - item.setWoodYield(LandCoverType.UNMANAGED_FOREST, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "ntrl_to_forC") * conversionFactor); - item.setWoodYield(LandCoverType.UNMANAGED_FOREST, LandCoverType.UNMANAGED_FOREST, getValueForCol(rowValues, "ntrl_to_ntrl") * conversionFactor); - item.setWoodYield(LandCoverType.UNMANAGED_FOREST, LandCoverType.CROPLAND, getValueForCol(rowValues, "ntrl_to_crop") * conversionFactor); - item.setWoodYield(LandCoverType.UNMANAGED_FOREST, LandCoverType.OTHER_NATURAL, getValueForCol(rowValues, "ntrl_to_ntrl") * conversionFactor); + item.setWoodYield(LandCoverType.CARBON_FOREST, LandCoverType.CARBON_FOREST, getValueForCol(rowValues, "forC_to_forC") * conversionFactor); } } diff --git a/src/ac/ed/lurg/output/LpjgOutputer.java b/src/ac/ed/lurg/output/LpjgOutputer.java index 2562d1e2..712969d4 100644 --- a/src/ac/ed/lurg/output/LpjgOutputer.java +++ b/src/ac/ed/lurg/output/LpjgOutputer.java @@ -143,7 +143,7 @@ public class LpjgOutputer extends AbstractLandUseOutputer { double crop = item.getLandCoverFract(LandCoverType.CROPLAND); double pasture = item.getLandCoverFract(LandCoverType.PASTURE); - double forest = item.getLandCoverFract(LandCoverType.TIMBER_FOREST) + item.getLandCoverFract(LandCoverType.CARBON_FOREST) + item.getLandCoverFract(LandCoverType.UNMANAGED_FOREST); + double forest = item.getLandCoverFract(LandCoverType.TIMBER_FOREST) + item.getLandCoverFract(LandCoverType.CARBON_FOREST); double otherNatural = item.getLandCoverFract(LandCoverType.OTHER_NATURAL); double barren = item.getLandCoverFract(LandCoverType.BARREN); double urban = item.getLandCoverFract(LandCoverType.URBAN); @@ -172,7 +172,7 @@ public class LpjgOutputer extends AbstractLandUseOutputer { try { String landCoverFileName = outputDir.getPath() + File.separator + "GamsLandCoverFract.txt"; landCoverWriter = new BufferedWriter(new FileWriter(landCoverFileName, false)); - landCoverWriter.write("Lon Lat Year CROPLAND PASTURE TIMBER CARBON UNMANAGED NATURAL BARREN URBAN"); + landCoverWriter.write("Lon Lat Year CROPLAND PASTURE TIMBER CARBON NATURAL BARREN URBAN"); landCoverWriter.newLine(); for (Entry<RasterKey, LandUseItem> entry : landUseRaster.entrySet()) { @@ -192,11 +192,10 @@ public class LpjgOutputer extends AbstractLandUseOutputer { double pasture = item.getLandCoverFract(LandCoverType.PASTURE); double timberForest = item.getLandCoverFract(LandCoverType.TIMBER_FOREST); double carbonForest = item.getLandCoverFract(LandCoverType.CARBON_FOREST); - double unmanagedForest = item.getLandCoverFract(LandCoverType.UNMANAGED_FOREST); double natural = item.getLandCoverFract(LandCoverType.OTHER_NATURAL); double barren = item.getLandCoverFract(LandCoverType.BARREN); double urban = item.getLandCoverFract(LandCoverType.URBAN); - landCoverWriter.write(String.format("%.2f %.2f %d %.14f %.14f %.14f %.14f %.14f %.14f %.14f %.14f", lat, lon, year, crop, pasture, timberForest, carbonForest, unmanagedForest, natural, barren, urban)); + landCoverWriter.write(String.format("%.2f %.2f %d %.14f %.14f %.14f %.14f %.14f %.14f %.14f", lat, lon, year, crop, pasture, timberForest, carbonForest, natural, barren, urban)); landCoverWriter.newLine(); } } diff --git a/src/ac/ed/lurg/types/LandCoverType.java b/src/ac/ed/lurg/types/LandCoverType.java index 2784a4f6..945f3297 100644 --- a/src/ac/ed/lurg/types/LandCoverType.java +++ b/src/ac/ed/lurg/types/LandCoverType.java @@ -11,7 +11,6 @@ public enum LandCoverType { TIMBER_FOREST("timberForest", false, true, true, true), CARBON_FOREST("carbonForest", false, true, true, true), - UNMANAGED_FOREST ("unmanagedForest", true, true, true, true), OTHER_NATURAL ("otherNatural", true, true, true, false), CROPLAND ("cropland", false, true, false, false), PASTURE ("pasture", false, true, false, false), @@ -22,14 +21,14 @@ public enum LandCoverType { private boolean isProtectable; private boolean isConvertible; private boolean isNatural; - private boolean isForest; + private boolean isManagedForest; - LandCoverType(String name, boolean isProtectable, boolean isConvertible, boolean isNatural, boolean isForest) { + LandCoverType(String name, boolean isProtectable, boolean isConvertible, boolean isNatural, boolean isManagedForest) { this.name = name; this.isProtectable = isProtectable; this.isConvertible = isConvertible; this.isNatural = isNatural; - this.isForest = isForest; + this.isManagedForest = isManagedForest; } public String getName() { @@ -86,18 +85,16 @@ public enum LandCoverType { } - /* - public static Collection<LandCoverType> getConvertibleNonForestTypes() { + public static Collection<LandCoverType> getManagedForestTypes() { - Collection<LandCoverType> convNonforestTypes = new HashSet<LandCoverType>(); + Collection<LandCoverType> managedForestTypes = new HashSet<LandCoverType>(); for (LandCoverType c : values()) - if (!c.isForest & c.isConvertible) - convNonforestTypes.add(c); + if (c.isManagedForest) + managedForestTypes.add(c); - return convNonforestTypes; + return managedForestTypes; } - */ } -- GitLab