Skip to content

Commit

Permalink
Merge pull request #167 from wri/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
manukala6 authored Jan 31, 2023
2 parents c0f61e0 + 5787a80 commit a36c414
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 21 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ target
*.jar
*.crc
_SUCCESS
*.bloop/
*.bsp/
*.metals/
/project


*.pyc
.project
Expand Down Expand Up @@ -50,4 +55,3 @@ derby.log
metastore_db/
*.log
*.tsv
*.csv
6 changes: 1 addition & 5 deletions src/main/resources/raster-catalog-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
{
"name":"wdpa_protected_areas",
"source_uri":"s3://gfw-data-lake/wdpa_protected_areas/v202204/raster/epsg-4326/{grid_size}/{row_count}/iucn_cat/geotiff/{tile_id}.tif"
"source_uri":"s3://gfw-data-lake/wdpa_protected_areas/v202208/raster/epsg-4326/{grid_size}/{row_count}/iucn_cat/geotiff/{tile_id}.tif"
},
{
"name":"gfw_oil_gas",
Expand Down Expand Up @@ -56,10 +56,6 @@
"name":"gfw_forest_carbon_net_flux",
"source_uri":"s3://gfw-data-lake/gfw_forest_carbon_net_flux/v20210331/raster/epsg-4326/{grid_size}/{row_count}/Mg_CO2e_ha-1/geotiff/{tile_id}.tif"
},
{
"name":"wdpa_protected_areas",
"source_uri":"s3://gfw-data-lake/wdpa_protected_areas/v202106/raster/epsg-4326/{grid_size}/{row_count}/is/geotiff/{tile_id}.tif"
},
{
"name":"gfw_pixel_area",
"source_uri":"s3://gfw-data-lake/gfw_pixel_area/v20150327/raster/epsg-4326/{grid_size}/{row_count}/m2/geotiff/{tile_id}.tif"
Expand Down
8 changes: 2 additions & 6 deletions src/main/resources/raster-catalog-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
},
{
"name":"wdpa_protected_areas",
"source_uri":"s3://gfw-data-lake/wdpa_protected_areas/v202106/raster/epsg-4326/{grid_size}/{row_count}/iucn_cat/gdal-geotiff/{tile_id}.tif"
"source_uri":"s3://gfw-data-lake/wdpa_protected_areas/v202208/raster/epsg-4326/{grid_size}/{row_count}/iucn_cat/gdal-geotiff/{tile_id}.tif"
},
{
"name":"gfw_oil_gas",
"source_uri":"s3://gfw-data-lake/gfw_oil_gas/v20190321/raster/epsg-4326/{grid_size}/{row_count}/is/gdal-geotiff/{tile_id}.tif"
"source_uri":"s3://gfw-data-lake/gfw_oil_gas/v20221024/raster/epsg-4326/{grid_size}/{row_count}/is/gdal-geotiff/{tile_id}.tif"
},
{
"name":"idn_forest_area",
Expand Down Expand Up @@ -52,10 +52,6 @@
"name":"gfw_forest_carbon_net_flux",
"source_uri":"s3://gfw-data-lake/gfw_forest_carbon_net_flux/v20210331/raster/epsg-4326/{grid_size}/{row_count}/Mg_CO2e_ha-1/gdal-geotiff/{tile_id}.tif"
},
{
"name":"wdpa_protected_areas",
"source_uri":"s3://gfw-data-lake/wdpa_protected_areas/v202106/raster/epsg-4326/{grid_size}/{row_count}/is/gdal-geotiff/{tile_id}.tif"
},
{
"name":"gfw_pixel_area",
"source_uri":"s3://gfw-data-lake/gfw_pixel_area/v20150327/raster/epsg-4326/{grid_size}/{row_count}/m2/gdal-geotiff/{tile_id}.tif"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.locationtech.jts
import org.apache.spark.sql.{DataFrame, Row, SparkSession}
import org.apache.spark.sql.functions.{col, isnull, udf}
import org.globalforestwatch.util.GeotrellisGeometryValidator.preserveGeometryType
import org.globalforestwatch.util.GfwGeometryFixer
import org.locationtech.jts.geom.util.GeometryFixer
import org.locationtech.jts.geom.{Envelope, Geometry, MultiPolygon, Polygon}
import org.globalforestwatch.util.GfwGeometryFixer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ object ValidatedFeatureRDD {
}

private def splitGeometries(
featureType: String,
featureDF: DataFrame,
spark: SparkSession
): RDD[ValidatedLocation[Geometry]] = {
featureType: String,
featureDF: DataFrame,
spark: SparkSession
): RDD[ValidatedLocation[Geometry]] = {
val spatialFeatureRDD: SpatialRDD[Geometry] = Adapter.toSpatialRdd(featureDF, "polyshape")
spatialFeatureRDD.analyze()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ object ForestChangeDiagnosticAnalysis extends SummaryAnalysis {
} else {
data.copy(
commodity_threat_fires = fire.getOrElse(ForestChangeDiagnosticDataLossYearly.empty),
tree_cover_loss_soy_yearly = data.tree_cover_loss_soy_yearly.limitToMaxYear(2020)
tree_cover_loss_soy_yearly = data.tree_cover_loss_soy_yearly.limitToMaxYear(2021)
)
}
}
Expand Down Expand Up @@ -214,7 +214,7 @@ object ForestChangeDiagnosticAnalysis extends SummaryAnalysis {
}
.reduceByKey(_ merge _)
.mapValues { fires =>
aggregateFireData(fires.merge(ForestChangeDiagnosticDataLossYearly.prefilled)).limitToMaxYear(2020)
aggregateFireData(fires.merge(ForestChangeDiagnosticDataLossYearly.prefilled)).limitToMaxYear(2021)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ case class ForestChangeDiagnosticData(
*/
def withUpdatedCommodityRisk(): ForestChangeDiagnosticData = {

/* Exclude the last year, limit data to 2020 to sync with palm risk tool:
/* Exclude the last year, limit data to 2021 to sync with palm risk tool:
commodity_threat_deforestation, commodity_threat_peat, commodity_threat_protected_areas use year n and year n-1.
Including information from the current year would under-represent these values as it's in progress.
*/
val minLossYear = ForestChangeDiagnosticDataLossYearly.prefilled.value.keys.min
val maxLossYear = 2020
val maxLossYear = 2021
val years: List[Int] = List.range(minLossYear + 1, maxLossYear + 1)

val forestValueIndicator: ForestChangeDiagnosticDataValueYearly =
Expand Down

Large diffs are not rendered by default.

0 comments on commit a36c414

Please sign in to comment.