From 662d047b03002af1fa40f3041648450aefcfa0f5 Mon Sep 17 00:00:00 2001 From: Dan Scales Date: Sun, 22 Dec 2024 08:39:01 -0800 Subject: [PATCH] Added 4 more commodities, just missing SUGC (sugarcane) --- src/main/resources/raster-catalog-pro.json | 24 +++++++++++++++---- .../summarystats/ghg/GHGGridSources.scala | 4 ++++ .../summarystats/ghg/GHGSummary.scala | 3 ++- .../summarystats/ghg/GHGTile.scala | 4 ++++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/main/resources/raster-catalog-pro.json b/src/main/resources/raster-catalog-pro.json index b3c9e42e..d2a53a5c 100755 --- a/src/main/resources/raster-catalog-pro.json +++ b/src/main/resources/raster-catalog-pro.json @@ -268,10 +268,6 @@ "name":"col_frontera_agricola", "source_uri":"s3://gfw-data-lake/col_frontera_agricola/v2024/raster/epsg-4326/{grid_size}/{row_count}/category/gdal-geotiff/{tile_id}.tif" }, - { - "name":"mapspam_yield_coco", - "source_uri":"s3://gfw-data-lake/mapspam_yield_coco/v2020/raster/epsg-4326/{grid_size}/{row_count}/yield/gdal-geotiff/{tile_id}.tif" - }, { "name":"gfw_forest_flux_full_extent_gross_emissions_co2_only_biomass_soil", "source_uri": "s3://gfw-data-lake/gfw_forest_flux_full_extent_gross_emissions_co2_only_biomass_soil/v20240402/raster/epsg-4326/{grid_size}/{row_count}/Mg_CO2_ha-1/geotiff/{tile_id}.tif" @@ -279,6 +275,26 @@ { "name":"gfw_forest_flux_full_extent_gross_emissions_non_co2_biomass_soil", "source_uri": "s3://gfw-data-lake/gfw_forest_flux_full_extent_gross_emissions_non_co2_biomass_soil/v20240402/raster/epsg-4326/{grid_size}/{row_count}/Mg_CO2e_ha-1/geotiff/{tile_id}.tif" + }, + { + "name":"mapspam_yield_coco", + "source_uri":"s3://gfw-data-lake/mapspam_yield_coco/v2020/raster/epsg-4326/{grid_size}/{row_count}/yield/gdal-geotiff/{tile_id}.tif" + }, + { + "name":"mapspam_yield_coff", + "source_uri":"s3://gfw-data-lake/mapspam_yield_coff/v2020/raster/epsg-4326/{grid_size}/{row_count}/yield/gdal-geotiff/{tile_id}.tif" + }, + { + "name":"mapspam_yield_oilp", + "source_uri":"s3://gfw-data-lake/mapspam_yield_oilp/v2020/raster/epsg-4326/{grid_size}/{row_count}/yield/gdal-geotiff/{tile_id}.tif" + }, + { + "name":"mapspam_yield_rubb", + "source_uri":"s3://gfw-data-lake/mapspam_yield_rubb/v2020/raster/epsg-4326/{grid_size}/{row_count}/yield/gdal-geotiff/{tile_id}.tif" + }, + { + "name":"mapspam_yield_soyb", + "source_uri":"s3://gfw-data-lake/mapspam_yield_soyb/v2020/raster/epsg-4326/{grid_size}/{row_count}/yield/gdal-geotiff/{tile_id}.tif" } ] } diff --git a/src/main/scala/org/globalforestwatch/summarystats/ghg/GHGGridSources.scala b/src/main/scala/org/globalforestwatch/summarystats/ghg/GHGGridSources.scala index d76027d9..6831e99d 100644 --- a/src/main/scala/org/globalforestwatch/summarystats/ghg/GHGGridSources.scala +++ b/src/main/scala/org/globalforestwatch/summarystats/ghg/GHGGridSources.scala @@ -16,6 +16,10 @@ case class GHGGridSources(gridTile: GridTile, kwargs: Map[String, Any]) val grossEmissionsCo2eNonCo2: GrossEmissionsNonCo2Co2eBiomassSoil = GrossEmissionsNonCo2Co2eBiomassSoil(gridTile, kwargs = kwargs) val grossEmissionsCo2eCo2Only: GrossEmissionsCo2OnlyCo2BiomassSoil = GrossEmissionsCo2OnlyCo2BiomassSoil(gridTile, kwargs = kwargs) val mapspamCOCOYield: MapspamYield = MapspamYield("COCO", gridTile, kwargs = kwargs) + val mapspamCOFFYield: MapspamYield = MapspamYield("COFF", gridTile, kwargs = kwargs) + val mapspamOILPYield: MapspamYield = MapspamYield("OILP", gridTile, kwargs = kwargs) + val mapspamRUBBYield: MapspamYield = MapspamYield("RUBB", gridTile, kwargs = kwargs) + val mapspamSOYBYield: MapspamYield = MapspamYield("SOYB", gridTile, kwargs = kwargs) def readWindow( windowKey: SpatialKey, diff --git a/src/main/scala/org/globalforestwatch/summarystats/ghg/GHGSummary.scala b/src/main/scala/org/globalforestwatch/summarystats/ghg/GHGSummary.scala index fba1ff97..c32b25a0 100644 --- a/src/main/scala/org/globalforestwatch/summarystats/ghg/GHGSummary.scala +++ b/src/main/scala/org/globalforestwatch/summarystats/ghg/GHGSummary.scala @@ -83,7 +83,8 @@ object GHGSummary { } // Get default yield based on commodity - var cropYield = raster.tile.cocoYield.getData(col, row) + var cropYield = raster.tile.soybYield.getData(col, row) + println(s"Yield ${cropYield}, (${col}, ${row})") if (cropYield == 0) { println("Empty cocoa yield") val backupArray = kwargs("backupYield").asInstanceOf[Broadcast[Array[Row]]].value diff --git a/src/main/scala/org/globalforestwatch/summarystats/ghg/GHGTile.scala b/src/main/scala/org/globalforestwatch/summarystats/ghg/GHGTile.scala index d714ac50..b7f63879 100644 --- a/src/main/scala/org/globalforestwatch/summarystats/ghg/GHGTile.scala +++ b/src/main/scala/org/globalforestwatch/summarystats/ghg/GHGTile.scala @@ -19,6 +19,10 @@ case class GHGTile( lazy val grossEmissionsCo2eNonCo2 = sources.grossEmissionsCo2eNonCo2.fetchWindow(windowKey, windowLayout) lazy val grossEmissionsCo2eCo2Only = sources.grossEmissionsCo2eCo2Only.fetchWindow(windowKey, windowLayout) lazy val cocoYield = sources.mapspamCOCOYield.fetchWindow(windowKey, windowLayout) + lazy val coffYield = sources.mapspamCOFFYield.fetchWindow(windowKey, windowLayout) + lazy val oilpYield = sources.mapspamOILPYield.fetchWindow(windowKey, windowLayout) + lazy val rubbYield = sources.mapspamRUBBYield.fetchWindow(windowKey, windowLayout) + lazy val soybYield = sources.mapspamSOYBYield.fetchWindow(windowKey, windowLayout) def cellType: CellType = loss.cellType