Skip to content

Commit

Permalink
GTC-2718 Add SBTN to AUM analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
manukala6 committed Jul 22, 2024
1 parent b7832a5 commit 7ffc207
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 29 deletions.
3 changes: 0 additions & 3 deletions src/main/resources/raster-catalog-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@
"name":"gfw_forest_flux_full_extent_net_flux",
"source_uri": "s3://gfw-data-lake/gfw_forest_flux_full_extent_net_flux/v20240402/raster/epsg-4326/{grid_size}/{row_count}/Mg_CO2e_ha-1/geotiff/{tile_id}.tif"
},


{
"name":"gfw_forest_flux_aboveground_carbon_stock_in_emissions_year",
"source_uri":"s3://gfw-data-lake/gfw_forest_flux_aboveground_carbon_stock_in_emissions_year/v20240308/raster/epsg-4326/{grid_size}/{row_count}/Mg_C_ha-1/geotiff/{tile_id}.tif"
Expand Down Expand Up @@ -310,7 +308,6 @@
"name":"gfw_soil_carbon_stock_2000",
"source_uri": "s3://gfw-data-lake/gfw_soil_carbon_stock_2000/v20231108/raster/epsg-4326/{grid_size}/{row_count}/Mg_C_ha-1/geotiff/{tile_id}.tif"
},

{
"name":"gfw_forest_flux_soil_carbon_stock_2000_stdev",
"source_uri":"s3://gfw-data-lake/gfw_forest_flux_soil_carbon_stock_2000_stdev/v20231108/raster/epsg-4326/{grid_size}/{row_count}/Mg_C_ha-1/geotiff/{tile_id}.tif"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ object AnnualUpdateMinimalDF {
"is__ifl_intact_forest_landscapes_2000",
"wri_tropical_tree_cover__decile",
"umd_global_land_cover__ipcc_class",
"sbtn_natural_forests__class",

// TODO delete next data update
"umd_tree_cover_density__threshold",
Expand Down Expand Up @@ -76,6 +77,7 @@ object AnnualUpdateMinimalDF {
$"data_group.intactForestLandscapes2000" as "is__ifl_intact_forest_landscapes_2000",
$"data_group.tmlDensity" as "wri_tropical_tree_cover__decile",
$"data_group.landCover" as "umd_global_land_cover__ipcc_class",
$"data_group.naturalForests" as "sbtn_natural_forests__class",

$"data.treecoverExtent2000" as "umd_tree_cover_extent_2000__ha",
$"data.treecoverExtent2010" as "umd_tree_cover_extent_2010__ha",
Expand Down Expand Up @@ -261,6 +263,7 @@ object AnnualUpdateMinimalDF {
max($"is__gfw_managed_forests") as "is__gfw_managed_forests",
max($"umd_tree_cover_gain__period") as "umd_tree_cover_gain__period",
max($"is__ifl_intact_forest_landscapes_2000") as "is__ifl_intact_forest_landscapes_2000",
max($"sbtn_natural_forests__class") as "sbtn_natural_forests__class",

max(length($"tsc_tree_cover_loss_drivers__type")).cast("boolean") as "tsc_tree_cover_loss_drivers__type",
max($"is__birdlife_alliance_for_zero_extinction_site") as "is__birdlife_alliance_for_zero_extinction_site",
Expand Down Expand Up @@ -318,6 +321,7 @@ object AnnualUpdateMinimalDF {
max($"is__gfw_managed_forests") as "is__gfw_managed_forests",
max($"umd_tree_cover_gain__period") as "umd_tree_cover_gain__period",
max($"is__ifl_intact_forest_landscapes_2000") as "is__ifl_intact_forest_landscapes_2000",
max($"sbtn_natural_forests__class") as "sbtn_natural_forests__class",

max($"tsc_tree_cover_loss_drivers__type") as "tsc_tree_cover_loss_drivers__type",
max($"is__birdlife_alliance_for_zero_extinction_site") as "is__birdlife_alliance_for_zero_extinction_site",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ case class AnnualUpdateMinimalDataGroup(lossYear: Integer,
gainPeriod: String,
intactForestLandscapes2000: Boolean,
landCover: String,
tmlDensity: Int
tmlDensity: Int,
naturalForests: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ case class AnnualUpdateMinimalGridSources(gridTile: GridTile, kwargs: Map[String
val abovegroundCarbon2000: AbovegroundCarbon2000 = AbovegroundCarbon2000(gridTile, kwargs = kwargs)
val belowgroundCarbon2000: BelowgroundCarbon2000 = BelowgroundCarbon2000(gridTile, kwargs = kwargs)
val mangroveBiomassExtent: MangroveBiomassExtent = MangroveBiomassExtent(gridTile, kwargs)
val naturalForests: SBTNNaturalForests = SBTNNaturalForests(gridTile, kwargs)

def readWindow(
windowKey: SpatialKey, windowLayout: LayoutDefinition
Expand Down Expand Up @@ -97,8 +98,8 @@ case class AnnualUpdateMinimalGridSources(gridTile: GridTile, kwargs: Map[String
val plantationsPre2000Tile = plantationsPre2000.fetchWindow(windowKey, windowLayout)
val abovegroundCarbon2000Tile = abovegroundCarbon2000.fetchWindow(windowKey, windowLayout)
val belowgroundCarbon2000Tile = belowgroundCarbon2000.fetchWindow(windowKey, windowLayout)
val mangroveBiomassExtentTile =
mangroveBiomassExtent.fetchWindow(windowKey, windowLayout)
val mangroveBiomassExtentTile = mangroveBiomassExtent.fetchWindow(windowKey, windowLayout)
val naturalForestsTile = naturalForests.fetchWindow(windowKey, windowLayout)

val tile = AnnualUpdateMinimalTile(
lossTile,
Expand Down Expand Up @@ -137,6 +138,7 @@ case class AnnualUpdateMinimalGridSources(gridTile: GridTile, kwargs: Map[String
abovegroundCarbon2000Tile,
belowgroundCarbon2000Tile,
mangroveBiomassExtentTile,
naturalForestsTile
)

Raster(tile, windowKey.extent(windowLayout))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import geotrellis.raster.summary.GridVisitor
import org.globalforestwatch.summarystats.Summary
import org.globalforestwatch.util.Geodesy
import org.globalforestwatch.util.Implicits._

/** LossData Summary by year */
case class AnnualUpdateMinimalSummary(
stats: Map[AnnualUpdateMinimalDataGroup, AnnualUpdateMinimalData] = Map.empty
Expand Down Expand Up @@ -48,30 +47,22 @@ object AnnualUpdateMinimalSummary {
val plantedForests: String = raster.tile.plantedForests.getData(col, row)
val mangroves1996: Boolean = raster.tile.mangroves1996.getData(col, row)
val mangroves2020: Boolean = raster.tile.mangroves2020.getData(col, row)
val tigerLandscapes: Boolean =
raster.tile.tigerLandscapes.getData(col, row)
val tigerLandscapes: Boolean = raster.tile.tigerLandscapes.getData(col, row)
val landmark: Boolean = raster.tile.landmark.getData(col, row)
val keyBiodiversityAreas: Boolean =
raster.tile.keyBiodiversityAreas.getData(col, row)
val keyBiodiversityAreas: Boolean = raster.tile.keyBiodiversityAreas.getData(col, row)
val mining: Boolean = raster.tile.mining.getData(col, row)
val peatlands: Boolean = raster.tile.peatlands.getData(col, row)
val oilPalm: Boolean = raster.tile.oilPalm.getData(col, row)
val idnForestMoratorium: Boolean =
raster.tile.idnForestMoratorium.getData(col, row)
val idnForestMoratorium: Boolean = raster.tile.idnForestMoratorium.getData(col, row)
val woodFiber: Boolean = raster.tile.woodFiber.getData(col, row)
val resourceRights: Boolean =
raster.tile.resourceRights.getData(col, row)
val resourceRights: Boolean = raster.tile.resourceRights.getData(col, row)
val logging: Boolean = raster.tile.logging.getData(col, row)
val intactForestLandscapes2000: Boolean =
raster.tile.intactForestLandscapes2000.getData(col, row)
val treeCoverLossFromFires: Boolean =
raster.tile.treeCoverLossFromFires.getData(col, row)
val tropicalTreeCover: Int =
raster.tile.tropicalTreeCover.getData(col, row)
val umdGlobalLandCover: String =
raster.tile.umdGlobalLandCover.getData(col, row)
val plantationsPre2000: Boolean =
raster.tile.plantationsPre2000.getData(col, row)
val intactForestLandscapes2000: Boolean = raster.tile.intactForestLandscapes2000.getData(col, row)
val treeCoverLossFromFires: Boolean = raster.tile.treeCoverLossFromFires.getData(col, row)
val tropicalTreeCover: Int = raster.tile.tropicalTreeCover.getData(col, row)
val umdGlobalLandCover: String = raster.tile.umdGlobalLandCover.getData(col, row)
val plantationsPre2000: Boolean = raster.tile.plantationsPre2000.getData(col, row)
val naturalForests: String = raster.tile.naturalForests.getData(col, row)

val lat: Double = raster.rasterExtent.gridRowToMap(row)
val area: Double = Geodesy.pixelArea(lat, raster.cellSize) // uses Pixel's center coordiate. +- raster.cellSize.height/2 doesn't make much of a difference
Expand All @@ -85,10 +76,8 @@ object AnnualUpdateMinimalSummary {

val grossEmissionsCo2eNonCo2: Float = raster.tile.grossEmissionsCo2eNonCo2.getData(col, row)
val grossEmissionsCo2eCo2Only: Float = raster.tile.grossEmissionsCo2eCo2Only.getData(col, row)
val grossCumulAbovegroundRemovalsCo2: Float =
raster.tile.grossCumulAbovegroundRemovalsCo2.getData(col, row)
val grossCumulBelowgroundRemovalsCo2: Float =
raster.tile.grossCumulBelowgroundRemovalsCo2.getData(col, row)
val grossCumulAbovegroundRemovalsCo2: Float = raster.tile.grossCumulAbovegroundRemovalsCo2.getData(col, row)
val grossCumulBelowgroundRemovalsCo2: Float = raster.tile.grossCumulBelowgroundRemovalsCo2.getData(col, row)
val netFluxCo2: Float = raster.tile.netFluxCo2.getData(col, row)
val soilCarbon2000PerHa: Float = raster.tile.soilCarbon2000.getData(col, row)
val abovegroundCarbon2000PerHa: Float = raster.tile.abovegroundCarbon2000.getData(col, row)
Expand Down Expand Up @@ -135,6 +124,7 @@ object AnnualUpdateMinimalSummary {
intactForestLandscapes2000,
umdGlobalLandCover,
tropicalTreeCover,
naturalForests
)

val summary: AnnualUpdateMinimalData =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ case class AnnualUpdateMinimalTile(
abovegroundCarbon2000: AbovegroundCarbon2000#OptionalFTile,
belowgroundCarbon2000: BelowgroundCarbon2000#OptionalFTile,
mangroveBiomassExtent: MangroveBiomassExtent#OptionalITile,
naturalForests: SBTNNaturalForests#OptionalITile
) extends CellGrid[Int] {
def cellType: CellType = loss.cellType
def cols: Int = loss.cols
Expand Down

0 comments on commit 7ffc207

Please sign in to comment.