diff --git a/src/main/scala/org/globalforestwatch/summarystats/gfwpro_dashboard/GfwProDashboardAnalysis.scala b/src/main/scala/org/globalforestwatch/summarystats/gfwpro_dashboard/GfwProDashboardAnalysis.scala index dd48cf73..5e10e518 100644 --- a/src/main/scala/org/globalforestwatch/summarystats/gfwpro_dashboard/GfwProDashboardAnalysis.scala +++ b/src/main/scala/org/globalforestwatch/summarystats/gfwpro_dashboard/GfwProDashboardAnalysis.scala @@ -97,8 +97,13 @@ object GfwProDashboardAnalysis extends SummaryAnalysis { } .flatMap { enrichedRDD => val fireStatsRDD = fireStats(enrichedRDD, fireAlertRDD, spark) + enrichedRDD.collect().foreach(println) val tmp = enrichedRDD.map { case Location(id, geom) => Feature(geom, id) } - val validatedSummaryStatsRdd = GfwProDashboardRDD(tmp, GfwProDashboardGrid.blockTileGrid, kwargs) + // This is where the main analysis happens, including calling + // GfwProDashboardSummary.getGridVisitor.visit on each pixel. + val validatedSummaryStatsRdd = GfwProDashboardRDD(tmp, + GfwProDashboardGrid.blockTileGrid, + kwargs + ("getRasterGadm" -> !doGadmIntersect)) ValidatedWorkflow(validatedSummaryStatsRdd).mapValid { summaryStatsRDD => summaryStatsRDD //.flatMapValues(_.toGfwProDashboardData()) diff --git a/src/main/scala/org/globalforestwatch/summarystats/gfwpro_dashboard/GfwProDashboardSummary.scala b/src/main/scala/org/globalforestwatch/summarystats/gfwpro_dashboard/GfwProDashboardSummary.scala index 096e7f35..93774236 100644 --- a/src/main/scala/org/globalforestwatch/summarystats/gfwpro_dashboard/GfwProDashboardSummary.scala +++ b/src/main/scala/org/globalforestwatch/summarystats/gfwpro_dashboard/GfwProDashboardSummary.scala @@ -63,14 +63,19 @@ object GfwProDashboardSummary { val naturalForestCategory: String = raster.tile.sbtnNaturalForest.getData(col, row) val jrcForestCover: Boolean = raster.tile.jrcForestCover.getData(col, row) - val gadmAdm0: String = raster.tile.gadm0.getData(col, row) - // Skip processing this pixel if gadmAdm0 is empty - if (gadmAdm0 == "") { - return + val gadmId: String = if (kwargs("getRasterGadm") == true) { + val gadmAdm0: String = raster.tile.gadm0.getData(col, row) + // Skip processing this pixel if gadmAdm0 is empty + if (gadmAdm0 == "") { + return + } + val gadmAdm1: Integer = raster.tile.gadm1.getData(col, row) + val gadmAdm2: Integer = raster.tile.gadm2.getData(col, row) + s"$gadmAdm0.$gadmAdm1.$gadmAdm2" + } else { + "" } - val gadmAdm1: Integer = raster.tile.gadm1.getData(col, row) - val gadmAdm2: Integer = raster.tile.gadm2.getData(col, row) - val gadmId: String = s"$gadmAdm0.$gadmAdm1.$gadmAdm2" + val groupKey = GfwProDashboardRawDataGroup(gadmId, integratedAlertDateAndConf, integratedAlertCoverage,