sepal-contrib / se.plan

tool to provide infomation on restoration planning
MIT License
9 stars 4 forks source link

when loading restoration map fro Lima province in Peru the app crashes #132

Closed 12rambau closed 2 years ago

12rambau commented 2 years ago

Tested with Roccio Condor and the following recipe:

{"aoi_model": {"asset_name": {"pathname": null, "column": null, "value": null}, "admin": 2342, "vector_json": {"pathname": null, "column": null, "value": null}, "point_json": {"pathname": null, "id_column": null, "lat_column": null, "lng_column": null}, "method": "ADMIN1", "name": "PER_Lima", "feature_collection": null, "gdf": null}, "layer_model": {"layer_list": [{"id": "woodfuel_harvest", "name": "Woodfuel harvest", "layer": "projects/john-ee-282116/assets/fao-restoration/features/Woodfuel_gadm36_1_edited_image", "unit": "m3/ha", "weight": 0, "theme": "benefit", "subtheme": "Local livelihoods", "operator": "", "norm_weight": 0.25}, {"id": "plantation_growth_rates", "name": "Plantation growth rate", "layer": "projects/john-ee-282116/assets/fao-restoration/features/yields-4326", "unit": "dry tons/ha/yr", "weight": 0, "theme": "benefit", "subtheme": "Wood production", "operator": "", "norm_weight": 0.25}, {"id": "city_access", "name": "Accessibility to cities", "layer": "Oxford/MAP/accessibility_to_cities_2015_v1_0", "unit": "hours", "weight": 0, "theme": "constraint", "subtheme": "Socio-economic", "operator": "gt"}, {"id": "forest_job", "name": "Forest employment", "layer": "projects/john-ee-282116/assets/fao-restoration/features/emp_ha", "unit": "jobs/ha", "weight": 0, "theme": "benefit", "subtheme": "Local livelihoods", "operator": ""}, {"id": "ground_carbon", "name": "Aboveground carbon accumulation", "layer": "projects/john-ee-282116/assets/fao-restoration/features/young_forest_sequestration_rate_Griscom_extent", "unit": "tons/ha/yr", "weight": 0, "theme": "benefit", "subtheme": "Carbon sequestration", "operator": "", "norm_weight": 0.25}, {"id": "biodiversity_intactness", "name": "Biodiversity Intactness Index", "layer": "projects/john-ee-282116/assets/fao-restoration/features/ibii-4326", "unit": "percent", "weight": 0, "theme": "benefit", "subtheme": "Biodiversity conservation", "operator": "", "norm_weight": 0.25}, {"id": "endangered_species", "name": "Endangered species", "layer": "projects/john-ee-282116/assets/fao-restoration/features/terra-bio-div-image", "unit": "number/km2", "weight": 0, "theme": "benefit", "subtheme": "Biodiversity conservation", "operator": ""}, {"id": "ecozones", "name": "Terrestrial ecoregion", "layer": "projects/john-ee-282116/assets/fao-restoration/features/gez_2010_wgs84_split", "unit": "binary", "weight": 0, "theme": "constraint", "subtheme": "Biophysical", "operator": ""}, {"id": "land_cover", "name": "Current land cover", "layer": "COPERNICUS/Landcover/100m/Proba-V-C3/Global/2019", "unit": "binary", "weight": 0, "theme": "constraint", "subtheme": "Socio-economic", "operator": ""}, {"id": "protected_areas", "name": "Protected areas", "layer": "projects/john-ee-282116/assets/fao-restoration/features/protected_areas", "unit": "binary", "weight": 0, "theme": "constraint", "subtheme": "Socio-economic", "operator": ""}, {"id": "slope", "name": "Slope", "layer": "projects/john-ee-282116/assets/fao-restoration/features/slope", "unit": "percent", "weight": 0, "theme": "constraint", "subtheme": "Biophysical ", "operator": "gt"}, {"id": "elevation", "name": "Elevation", "layer": "USGS/SRTMGL1_003", "unit": "m", "weight": 0, "theme": "constraint", "subtheme": "Biophysical ", "operator": "gt"}, {"id": "natural_regeneration", "name": "Natural regeneration variability", "layer": "projects/john-ee-282116/assets/fao-restoration/features/Regeneration", "unit": "index (0 to 1)", "weight": 0, "theme": "constraint", "subtheme": "Forest change", "operator": "lt"}, {"id": "declining_population", "name": "Declining population", "layer": "projects/john-ee-282116/assets/fao-restoration/features/population_decline", "unit": "binary", "weight": 0, "theme": "constraint", "subtheme": "Socio-economic", "operator": ""}, {"id": "property_rights", "name": "Property rights protection", "layer": "projects/john-ee-282116/assets/fao-restoration/features/RL_gadm36_1_edited_image", "unit": "index (-2.5 to 2.5)", "weight": 0, "theme": "constraint", "subtheme": "Socio-economic", "operator": "gt"}, {"id": "deforestation_rate", "name": "Deforestation rate", "layer": "projects/john-ee-282116/assets/fao-restoration/features/deforestation_rate", "unit": "percent/yr", "weight": 0, "theme": "constraint", "subtheme": "Forest change", "operator": "lt"}, {"id": "climate_risk", "name": "Climate risk", "layer": "projects/john-ee-282116/assets/fao-restoration/features/future_risk", "unit": "percent", "weight": 0, "theme": "constraint", "subtheme": "Forest change", "operator": "gt"}, {"id": "population_density", "name": "Population density", "layer": "CIESIN/GPWv411/GPW_Population_Density/gpw_v4_population_density_rev11_2015_30_sec", "unit": "people/km2", "weight": 0, "theme": "constraint", "subtheme": "Socio-economic", "operator": "lt"}, {"id": "annual_rainfall", "name": "Annual rainfall", "layer": "projects/john-ee-282116/assets/fao-restoration/features/chirps_00_20_mean", "unit": "mm/yr", "weight": 0, "theme": "constraint", "subtheme": "Biophysical", "operator": "gt"}, {"id": "treecover_with_potential", "name": "Current tree cover less than potential", "layer": "projects/john-ee-282116/assets/fao-restoration/features/rest_pot_gt_treecoverfrac_mask_urban", "unit": "binary", "weight": 0, "theme": "constraint", "subtheme": "", "operator": ""}, {"id": "opportunity_cost", "name": "Land opportunity cost", "layer": "projects/john-ee-282116/assets/fao-restoration/features/opportunity_cost", "unit": "$/ha", "weight": 0, "theme": "cost", "subtheme": "", "operator": ""}, {"id": "water_stress", "name": "Baseline water stress", "layer": "projects/john-ee-282116/assets/fao-restoration/features/bws_score", "unit": "index (0 to 5)", "weight": 0, "theme": "constraint", "subtheme": "Biophysical", "operator": "lt"}, {"id": "implementation_cost", "name": "Implementation cost", "layer": "projects/john-ee-282116/assets/fao-restoration/features/AfCost_ha", "unit": "$/ha", "weight": 0, "theme": "cost", "subtheme": "monetary", "operator": ""}]}, "question_model": {"constraints": "{\"shrub\": -1, \"herbaceous\": -1, \"agriculture\": -1, \"urban\": -1, \"bare\": -1, \"snow\": -1, \"wetland\": -1, \"moss\": -1, \"annual_rainfall\": -1, \"water_stress\": -1, \"elevation\": [-10, 407.4], \"slope\": -1, \"city_access\": -1, \"population_density\": -1, \"protected_areas\": -1, \"property_rights\": -1, \"deforestation_rate\": -1, \"climate_risk\": -1, \"natural_regeneration\": -1, \"declining_population\": -1}", "priorities": "{\"biodiversity_intactness\": 4, \"endangered_species\": 0, \"ground_carbon\": 4, \"woodfuel_harvest\": 4, \"forest_job\": 0, \"plantation_growth_rates\": 4}", "recipe_name": "recipe_2022-05-19"}}
12rambau commented 2 years ago

I checked on GEE. the problem is coming from the Carbon sequestration layer that does not covers the whole world. Use se.plan on all Peru and everything will work fine but use it in only the Lima province and se.plan canot compute the quintile normalization as the all image is nan/masked.

Capture d’écran 2022-05-21 à 22 10 42

Unselect the benefit and the computation will run like a charm as the priority will be excluded.

I'll try to add a safety lock but more importantly nan should be masked.