Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTC-2598 Fix gadm null filter #200

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/resources/raster-catalog-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
},
{
"name": "sbtn_natural_forests_map",
"source_uri": "s3://gfw-data-lake/sbtn_natural_forests_map/v202305/raster/epsg-4326/{grid_size}/{row_count}/class/gdal-geotiff/{tile_id}.tif"
"source_uri": "s3://gfw-data-lake/sbtn_natural_forests_map/v202310/raster/epsg-4326/{grid_size}/{row_count}/class/gdal-geotiff/{tile_id}.tif"
},
{
"name": "gfwpro_negligible_risk_analysis",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ object AFiAnalysis extends SummaryAnalysis {
val summaryDF = AFiAnalysis.aggregateResults(
AFiDF
.getFeatureDataFrame(summaryRDD, spark)
.filter(!$"gadm_id".contains("null"))
.withColumn(
"gadm_id", when(col("location_id") =!= -1|| col("gadm_id").contains("null"), lit("") ).otherwise(col("gadm_id"))
"gadm_id", when(col("location_id") =!= -1, lit("") ).otherwise(col("gadm_id"))
)
.groupBy($"list_id", $"location_id", $"gadm_id")
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ object AFiSummary {
val naturalForestCategory: String = raster.tile.sbtnNaturalForest.getData(col, row)
val negligibleRisk: String = raster.tile.negligibleRisk.getData(col, row)

val gadmAdm0: String = raster.tile.gadmAdm0.getData(col, row)
val gadmAdm1: Integer = raster.tile.gadmAdm1.getData(col, row)
val gadmAdm2: Integer = raster.tile.gadmAdm2.getData(col, row)
val gadmId: String = s"$gadmAdm0.$gadmAdm1.$gadmAdm2"
val gadmAdm0: String = raster.tile.gadmAdm0.getData(col, row)
// Skip processing this pixel if gadmAdm0 is empty
if (gadmAdm0 == "") {
return
}
val gadmAdm1: Integer = raster.tile.gadmAdm1.getData(col, row)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to add a comment here that either gadmAdm1 and gadmAdm1 could possibly be null (which came from a 9999 pixel value in the raster)

val gadmAdm2: Integer = raster.tile.gadmAdm2.getData(col, row)
val gadmId: String = s"$gadmAdm0.$gadmAdm1.$gadmAdm2"

// pixel Area
val lat: Double = raster.rasterExtent.gridRowToMap(row)
Expand Down
Loading