Skip to content

Commit

Permalink
Cleanup and adjusted test results.
Browse files Browse the repository at this point in the history
  • Loading branch information
danscales committed Jun 3, 2024
1 parent 6681c41 commit b848b60
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package org.globalforestwatch.layers

import org.globalforestwatch.grids.GridTile

// Colombia classification of all its lands into areas where agricultural activity is
// allowed, or is conditional, or is fully restricted.
case class ColFronteraAgricola(gridTile: GridTile, kwargs: Map[String, Any]) extends StringLayer with OptionalILayer {
val datasetName = "col_frontera_agricola"
val uri: String = uriForGrid(gridTile, kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ object GFWProCoverage {
def isArgentina(v: Integer): Boolean = (v & (1 << 0)) != 0
def isColombia(v: Integer): Boolean = (v & (1 << 1)) != 0
def isSouthAmerica(v: Integer): Boolean = (v & (1 << 2)) != 0
def isLegalAmazon(v: Integer): Boolean = (v & (1 << 3)) != 0
def isBrazilBiomes(v: Integer): Boolean = (v & (1 << 4)) != 0
def isCerradoBiomes(v: Integer): Boolean = (v & (1 << 5)) != 0
def isLegalAmazonPresence(v: Integer): Boolean = (v & (1 << 3)) != 0
// Brazil Biomes presence is true for all Brazil, except for a few narrow costal
// areas.
def isBrazilBiomesPresence(v: Integer): Boolean = (v & (1 << 4)) != 0
def isCerradoBiomesPresence(v: Integer): Boolean = (v & (1 << 5)) != 0
def isSouthEastAsia(v: Integer): Boolean = (v & (1 << 6)) != 0
def isIndonesia(v: Integer): Boolean = (v & (1 << 7)) != 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ case class ForestChangeDiagnosticData(
tree_cover_loss_intact_forest_yearly: ForestChangeDiagnosticDataLossYearly,
tree_cover_loss_protected_areas_yearly: ForestChangeDiagnosticDataLossYearly,
// The "tree_cover_loss_by_country_*" fields are only filled in per-country when
// countryCode != "" (currently only ARG and BRA). These are for umdLoss
// countryCode != "" (currently only ARG, BRA, and COL). These are for umdLoss
// comparison bars within the country-specific UI tabs.
tree_cover_loss_by_country_yearly: ForestChangeDiagnosticDataLossYearlyCategory,
tree_cover_loss_by_country_wdpa_yearly: ForestChangeDiagnosticDataLossYearlyTwoCategory,
tree_cover_loss_by_country_landmark_yearly: ForestChangeDiagnosticDataLossYearlyTwoCategory,
// Tree cover loss by country-specified classifications. For ARG, it is breakdown
// by OTBN categories, and for COL, it is breakdown by Frontera Agricola categories).
tree_cover_loss_by_country_classified_region_yearly: ForestChangeDiagnosticDataLossYearlyTwoCategory,
/** Tree cover loss in Argentina Native Forest Land Plan (OTBN) categories */
tree_cover_loss_arg_otbn_yearly: ForestChangeDiagnosticDataLossYearlyCategory,
Expand All @@ -38,6 +40,7 @@ case class ForestChangeDiagnosticData(
/** prodesLossProtectedAreasYearly */
tree_cover_loss_prodes_wdpa_yearly: ForestChangeDiagnosticDataLossYearly,
tree_cover_loss_prodes_primary_forest_yearly: ForestChangeDiagnosticDataLossYearly,
// The area in each of ARG, BRA, and COL. Only has entries for countries with non-zero overlap.
country_area: ForestChangeDiagnosticDataDoubleCategory,
// The "country_specific_deforestation_*" fields use the country-specific
// deforestation data, which may have approximate years (because some
Expand All @@ -46,8 +49,10 @@ case class ForestChangeDiagnosticData(
country_specific_deforestation_wdpa_yearly: ForestChangeDiagnosticDataLossApproxYearlyTwoCategory,
country_specific_deforestation_landmark_yearly: ForestChangeDiagnosticDataLossApproxYearlyTwoCategory,
// This is a country-specific categorization of country-specific deforestation. For
// Argentina, it is a breakdown into OTBN categories.
// ARG, it is a breakdown by OTBN categories, and for COL, it is breakdown by
// Frontera Agricola categories.
country_specific_deforestation_classified_region_yearly: ForestChangeDiagnosticDataLossApproxYearlyTwoCategory,
// Breakdown by country and country-specific category (OTBN for ARG and Frontera Agricola for COL)
classified_region_area: ForestChangeDiagnosticDataDoubleTwoCategory,
tree_cover_loss_brazil_biomes_yearly: ForestChangeDiagnosticDataLossYearlyCategory,
tree_cover_extent_total: ForestChangeDiagnosticDataDouble,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ object ForestChangeDiagnosticSummary {
}
}

val region: Int =
raster.tile.gfwProCoverage.getData(col, row)
val region: Int = raster.tile.gfwProCoverage.getData(col, row)
val argPresence = GFWProCoverage.isArgentina(region)
val colPresence = GFWProCoverage.isColombia(region)
val braBiomesPresence = GFWProCoverage.isBrazilBiomes(region)
val braBiomesPresence = GFWProCoverage.isBrazilBiomesPresence(region)
val argOTBN: String = raster.tile.argOTBN.getData(col, row)

// We compute country-specific forest loss using argForestLoss tile for
Expand Down Expand Up @@ -147,17 +146,17 @@ object ForestChangeDiagnosticSummary {
val isCountrySpecificLoss: Boolean = countrySpecificLossYear.year > 0

val southAmericaPresence = GFWProCoverage.isSouthAmerica(region)
val legalAmazonPresence = GFWProCoverage.isLegalAmazon(region)
val cerradoBiomesPresence = GFWProCoverage.isCerradoBiomes(region)
val legalAmazonPresence = GFWProCoverage.isLegalAmazonPresence(region)
val cerradoBiomesPresence = GFWProCoverage.isCerradoBiomesPresence(region)
val seAsiaPresence = GFWProCoverage.isSouthEastAsia(region)
val idnPresence = GFWProCoverage.isIndonesia(region)

val protectedAreaCategory = raster.tile.protectedAreasByCategory.getData(col, row)
val isProtectedArea = (protectedAreaCategory != "")

// Currently, only do the area intersection with the detailed WDPA categories
// if location is in Argentina. Similarly, only do area intersection with
// Landmark (indigenous territories) if in Argentina.
// if location is in ARG or COL. Similarly, only do area intersection with
// Landmark (indigenous territories) if in ARG or COL.
// With lazy tile loading, the landmark tiles are only loaded if
// argPresence is true.
val detailedWdpa = if (argPresence || colPresence)
Expand Down

This file was deleted.

Loading

0 comments on commit b848b60

Please sign in to comment.