wri / gfw_forest_loss_geotrellis

Global Tree Cover Loss Analysis using Geotrellis and SPARK
MIT License
10 stars 8 forks source link

Log out-of-bounds features #129

Open jpolchlo opened 2 years ago

jpolchlo commented 2 years ago

Pull request checklist

Please check if your PR fulfills the following requirements:

Pull request type

Please check the type of change your PR introduces: - [ ] Bugfix - [x] Feature - [ ] Code style update (formatting, renaming) - [ ] Refactoring (no functional changes, no api changes) - [ ] Build related changes - [ ] Documentation content changes - [ ] Other (please describe): ## What is the current behavior?

If inputs contain geometries that do not intersect the tree cover loss raster extent, those geometries will be lost. If the input contains only non-intersecting geometries, ForestChangeDiagnoticCommand will fail outright.

Issue Number: N/A

What is the new behavior?

I introduce a complementary join to ValidatedFeatureRDD that will identify geometries that have no intersection with the tree cover loss extent, and will track their feature IDs as NoIntersectionErrors. These will be propagated into the output.

Does this introduce a breaking change?

Other information

A test input containing only two out-of-bounds geometries yields the following final output:

list_id location_id     status_code     location_error  tree_cover_loss_total_yearly    tree_cover_loss_primary_forest_yearly   tree_cover_loss_peat_yearly     tree_cover_loss_intact_forest_yearly    tree_cover_loss_protected_areas_yearly  tree_cover_loss_sea_landcover_yearly    tree_cover_loss_idn_landcover_yearly    tree_cover_loss_soy_yearly      tree_cover_loss_idn_legal_yearly        tree_cover_loss_idn_forest_moratorium_yearly    tree_cover_loss_prodes_yearly   tree_cover_loss_prodes_wdpa_yearly      tree_cover_loss_prodes_primary_forest_yearly    tree_cover_loss_brazil_biomes_yearly    tree_cover_extent_total tree_cover_extent_primary_forest        tree_cover_extent_protected_areas       tree_cover_extent_peat  tree_cover_extent_intact_forest natural_habitat_primary natural_habitat_intact_forest   total_area      protected_areas_area    peat_area       brazil_biomes   idn_legal_area  sea_landcover_area      idn_landcover_area      idn_forest_moratorium_area      south_america_presence  legal_amazon_presence   brazil_biomes_presence  cerrado_biome_presence  southeast_asia_presence indonesia_presence      commodity_value_forest_extent   commodity_value_peat    commodity_value_protected_areas commodity_threat_deforestation  commodity_threat_peat   commodity_threat_protected_areas        commodity_threat_fires
266     1       3       ["NoIntersectionError"] {}      {}      {}      {}      {}      {}      {}      {}      {}      {}      {}      {}      {}      {}      0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     {}      {}      {}      {}      0.0     false   false   false   false   false   false   {}      {}      {}      {}      {}      {}      {}
266     -1      3       ["NoIntersectionError"] {}      {}      {}      {}      {}      {}      {}      {}      {}      {}      {}      {}      {}      {}      0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     {}      {}      {}      {}      0.0     false   false   false   false   false   false   {}      {}      {}      {}      {}      {}      {}