FATE simulationR/POST_FATE.graphic_mapPFG.R
POST_FATE.graphic_mapPFG.RdThis script is designed to produce one (or several) raster map
related to plant functional group results (richness, relative cover, light
or soil CWM) for one (or several) specific FATE simulation year.
POST_FATE.graphic_mapPFG(
name.simulation,
file.simulParam = NULL,
years,
doRichness = TRUE,
doCover = FALSE,
doLeinster = FALSE,
doCWM = FALSE,
opt.stratum_min = 0,
opt.stratum_max = 10,
opt.doBinary = TRUE,
opt.no_CPU = 1,
opt.doPlot = TRUE
)a string corresponding to the main directory
or simulation name of the FATE simulation
default NULL.
A string
corresponding to the name of a parameter file that will be contained into
the PARAM_SIMUL folder of the FATE simulation
an integer, or a vector of integer,
corresponding to the simulation year(s) that will be used to extract PFG
abundance and binary maps
default TRUE.
If TRUE, PFG richness
will be computed from binary maps
default FALSE.
If TRUE, PFG cover will
be computed from abundance maps
(PFG total abundance / max(PFG total abundance) per pixel)
default FALSE.
If TRUE, PFG diversity
will be computed from abundance maps based on Leinster's formul
default FALSE.
If TRUE, FATE light and/or
soil resources maps will be computed, and weighted by PFG light and/or
soil preferences/contribution to obtain a kind a community weighted mean
value per pixel
(optional) default 1.
An
integer corresponding to the lowest stratum from which PFG
abundances will be summed up
(optional) default 10.
An
integer corresponding to the highest stratum from which PFG
abundances will be summed up
(optional) default TRUE.
If
TRUE, abundance maps (absolute or relative) are systematically
multiplied by binary maps (see
Details)
(optional) default 1.
The number of
resources that can be used to parallelize the unzip/zip of raster
files
(optional) default TRUE.
If TRUE,
plot(s) will be processed, otherwise only the calculation and reorganization
of outputs will occur, be saved and returned
A list containing one or several (one for each simulation
year) list of raster and ggplot2 objects :
richnessraster of PFG richness
coverraster of relative coverage
DIV.0raster of PFG richness
DIV.1raster of Shannon entropy
DIV.2raster of Simpson concentration
CWM.lightraster of light community weighted mean
CWM.soilraster of soil community weighted mean
richnessggplot2 object, representing
richness raster
coverggplot2 object, representing cover
raster
leinsterggplot2 object, representing
DIV.0 raster
CWM.lightggplot2 object, representing
CWM.light raster
CWM.soilggplot2 object, representing
CWM.soil raster
POST_FATE_GRAPHIC_C_map_PFG_[...].pdf file is created containing up
to five graphics :
map_PFGrichnessto visualize the PFG richness within the studied area
map_PFGcoverto visualize the PFG cover within the studied area
map_PFGleinsterto visualize the PFG diversity within the studied area
PFGlightto visualize the light CWM within the studied area
PFGsoilto visualize the soil CWM within the studied area
Three PFGleinster_YEAR_[...]_STRATA_all_q[...].tif files are created
into the simulation results folder :
q0PFG richness
q1PFG Shannon entropy
q2PFG Simpson concentration
Raster files are also created for cover, and light and soil CWM if those
modules were selected (see PRE_FATE.params_globalParameters).
This function allows to obtain, for a specific FATE simulation and
a specific parameter file within this simulation, up to seven raster
maps and preanalytical graphics.
For each PFG and each selected simulation year, raster maps are retrieved
from the results folders ABUND_perPFG_perStrata and
BIN_perPFG_perStrata and unzipped.
Informations extracted lead to the production of up to seven graphics before
the maps are compressed again :
map of PFG richness within each pixel, representing the sum of binary maps
maps of PFG diversity within each pixel, calculated from PFG
abundances with the
Leinster & Cobbold
2012 Ecology framework which allows to give more or less importance to
the common species through the q parameter :
q = 0species richness
q = 1Shannon entropy
q = 2Simpson concentration
map of PFG relative cover, representing the sum of relative
abundance maps of all PFG
(potentially above a height threshold
defined by opt.stratum_min)
if light was activated (see
PRE_FATE.params_globalParameters), community
weighted mean of PFG light preferences (extracted from LIGHT
parameter within LIGHT files, see
PRE_FATE.params_PFGlight)
if soil was activated (see
PRE_FATE.params_globalParameters), community
weighted mean of PFG soil preferences (extracted from SOIL_CONTRIB
parameter within SOIL files, see
PRE_FATE.params_PFGsoil)
It requires that the POST_FATE.relativeAbund,
(POST_FATE.graphic_validationStatistics) and
POST_FATE.binaryMaps functions have been run and that the
folders BIN_perPFG_allStrata and BIN_perPFG_perStrata exist.
If opt.doBinary = TRUE, abundance maps (absolute or relative) are
systematically multiplied by binary maps extracted from
BIN_perPFG_allStrata and BIN_perPFG_perStrata folders and
produced by POST_FATE.binaryMaps function.
This way, produced raster maps reflect the validated/refined predictions.
opt.doBinary can be set to FALSE to reflect pure
simulation results.
if (FALSE) { # \dontrun{
POST_FATE.graphic_mapPFG(name.simulation = "FATE_simulation"
, file.simulParam = "Simul_parameters_V1.txt"
, years = 850
, opt.stratum_min = 3
, opt.no_CPU = 1)
POST_FATE.graphic_mapPFG(name.simulation = "FATE_simulation"
, file.simulParam = "Simul_parameters_V1.txt"
, year = c(850, 950)
, opt.doBinary = FALSE)
} # }