Here are two errors recently encountered when running CalculateAll() during the pressures calculation, and how we troubleshooted them. Both errors were due to data layers that were missing from the layers/ folder or not registered to layers.csv because it was not obvious that the Toolbox would need them. We try to improve the ohicore code to safe-guard against these sorts of problems but as a general guide, please do not remove layers from layers.csv from the spatial or weighting categories.
1. Error in UseMethod("select_")
There are 6 pressures subcategories: pollution, alien_species, habitat_destruction, fishing_pressure, climate_change, social
Error in UseMethod("select_") :
no applicable method for 'select_' applied to an object of class "NULL"
This error turned out to be due to the rgn_global layer not being registered. Adding this back to layers.csv fixed this error.
2. Error in filter_impl(.data, quo)
There are 6 pressures subcategories: pollution, alien_species, habitat_destruction, fishing_pressure, climate_change, social
Error in filter_impl(.data, quo) :
Evaluation error: object 'id_num' not found.
This error was because of three layers that were not registered in layers.csv or saved to the layers/ folder:
element_wts_cs_km2_x_storage
element_wts_cp_km2_x_protection
element_wts_hab_pres_abs
These layers are a bit confusing (and honestly, a bit unideal), but important for goals that have data for specific elements within them (in this case, habitats). These layers exist as .csv files but are actually blank except for the headers. They are calculated from within the CS, CP, and HAB goal models in functions.R and saved as an object for calculations but not as a .csv (because they will be overwritten each time CalculateAll is run.
The error was fixed by adding these (headers-only) csv files back to the layers/ folder and registering them in layers.csv.
We have also updated ohicore to include warning messages to warn for the need for these files in the future.
Here are two errors recently encountered when running
CalculateAll()during the pressures calculation, and how we troubleshooted them. Both errors were due to data layers that were missing from thelayers/folder or not registered tolayers.csvbecause it was not obvious that the Toolbox would need them. We try to improve theohicorecode to safe-guard against these sorts of problems but as a general guide, please do not remove layers fromlayers.csvfrom thespatialorweightingcategories.1. Error in UseMethod("select_")
This error turned out to be due to the
rgn_globallayer not being registered. Adding this back tolayers.csvfixed this error.2. Error in filter_impl(.data, quo)
This error was because of three layers that were not registered in
layers.csvor saved to thelayers/folder:element_wts_cs_km2_x_storageelement_wts_cp_km2_x_protectionelement_wts_hab_pres_absThese layers are a bit confusing (and honestly, a bit unideal), but important for goals that have data for specific elements within them (in this case, habitats). These layers exist as .csv files but are actually blank except for the headers. They are calculated from within the CS, CP, and HAB goal models in
functions.Rand saved as an object for calculations but not as a.csv(because they will be overwritten each timeCalculateAllis run.The error was fixed by adding these (headers-only) csv files back to the
layers/folder and registering them inlayers.csv.We have also updated
ohicoreto include warning messages to warn for the need for these files in the future.