The Toolbox is a collection of multiple interdependent R scripts and data files, organized in folders and sub-folders, used in calculating Ocean Health Index (OHI) scores. We call it the Toolbox because it consists of a set of discrete, partitioned tools. And we sometimes we refer to the integration of all these as an “ecosystem” since it’s the way the pieces fit together that allows the interesting things to happen, i.e. the score calculation from multiple data layers.
ohicore is one of three primary components and is the backbone software package of the Toolbox. The other two overarching components are the assessment repository (or “repo”) itself, and the data preparation. In regional OHI assessments (OHI+), data preparation is done in a subfolder within the assessment repository, and for global assessments, it is in a separate repo.
ohicore contains functions to create the ‘conf’ and ‘layers’ objects, check layers, calculate trends, resilience, pressure, and status, and finally to calculate and check the scores.
ohicore is an R package that contains all the core operations for the data preparation and models for your assessment, and it will calculate OHI scores once the Toolbox is configured.
An OHI repository or “repo” will contain the following:
referencePoints.csv, as well as conf, layers, spatial, and temp subfolders.
.gitignore, and maybe an
The “layers” and “conf” subfolders:
ohicore::CheckLayerstake as input
Configuring the Toolbox involves running the
Layers(). In the process of configuring the Toolbox, the
conf objects are created. These are in effect lists (a special type of R object) of the prepared input data (layers), and everything else (conf) which includes all the information from the following files: config.R, functions.R, goals.csv, pressures_matrix.csv, resilience_matrix.csv, resilience_weights.csv. These two objects are created so that automated checks can be run to confirm that everything is properly prepared and accounted for, and in a consistent format that the
ohicore score calculation functions can accept as input.
Configuration must be done each time models are edited or additional data is added to the data layers, prior to (re)calculating scores; i.e. if you have made changes to functions.R, goals.csv, or other files that become part of the
# set working directory to the scenario folder (that contains the conf folder) setwd('eez') # load scenario configuration conf <- ohicore::Conf('conf') # check that scenario layers files in the \layers folder match layers.csv registration # (layers files are not modified) ohicore::CheckLayers('layers.csv', 'layers', flds_id = conf$config$layers_id_fields) # load scenario layers for ohicore to access (layers files are not modified) layers <- ohicore::Layers('layers.csv', 'layers') # select scenario year for the assessment scenario_years <- 2016 layers$data$scenario_year <- scenario_years