Open sandra-neubert opened 1 month ago
A lot of the functions above (especially the similar ones) use very similar calculations (e.g. vals < 0 are set to 0; NAs are set to 0); are there any datasets where vals are accepted < 0 or are these general rules that could be integrated in a generic function @scabecks ?
Currently any negative values in input layers are normalised to [0,1] since I believe negative values cause problems for the optimisation model.
@scabecks I'm more wondering about the way this is done. Why not rescale with the negative values to 0-1? Why set them to 0 before the rescaling? This might potentially not represent the original distribution of the data anymore and the rescaling also works with negative values. (also just fyi, with the next update of priortizr, it will take negative values for the maximum utility objective function)
There are lots of functions that have a very similar structure that could easily be combined in a single function or there could be a data reading + rescaling utils function that is then simply called in the over-arching function. Thoughts @scabecks?
Very similar functions are:
~- [x] -
make_certified_forests()
(https://www.dropbox.com/scl/fi/k4fbd5buv7sr6zkebmt6f/FML_v3.2_near_cog.tif?rlkey=qcc0iza918cwf4addf8zwticr&dl=0)~make_crop_suitability_difference()
(https://www.dropbox.com/scl/fi/eiq0rwncx4317x79y8pe7/overall_cropsuit_i_diff_19812010_20712100.tif?rlkey=315w9rlzucynlh5u1v8azmzrk&dl=0)make_drought_risk()
make_flii()
make_flood_risk()
make_forest_integrity()
: this one also uses same code as inmake_flii()
make_intact_wilderness_area()
make_irrecoverable_carbon()
make_live_biomass_carbon()
make_soc_difference()
make_threatened_species_richness()
make_urban_extreme_heat()
make_vocc()
make_vulnerable_soc()
(https://www.dropbox.com/scl/fi/btaypk1cqw74f4hmirp7f/soc-at-risk-V11.tif?rlkey=spqisouwyokf8ijmrfcdsxtx8&dl=0)make_wad_convergence_evidence()
(https://www.dropbox.com/scl/fi/dekjbegbe6bwhfpdzzqwd/wad_final_cog.tif?rlkey=4u443d5f3o7ha8dljihmhsglf&dl=0)make_yield_gap()
Similar but uses
terra
make_landcover_layers()
make_managed_forests()
(https://www.dropbox.com/scl/fi/k4fbd5buv7sr6zkebmt6f/FML_v3.2_near_cog.tif?rlkey=qcc0iza918cwf4addf8zwticr&dl=0)Stand-alone functions seem to be:
make_kbas()
make_landmark_areas()
make_manage_zones()
make_mangroves()
make_mountains_glaciers()
make_planning_unit_layer()
make_productive_managed_forests()
make_protect_zone()
: accesses wdpa databasemake_protected_areas()
: accesses wdpa database (naming also sounds like a conservation planning function)make_restore_zone()
make_threatened_ecosystems()
: 2 subfunctionsmake_underepresented_ecosystems()
: 2 subfunctionsmake_urban_greening_zones()
make_wetlands_ramsar()
: 2 subfunctions