Description Usage Arguments Value Examples
View source: R/scores.fluxnet.site.R
This function compares model output in CSV format against
FLUXNET measurements in CSV format. Use this function when running your model
at each FLUXNET site individually. The performance of a model is
expressed through scores that range from zero to one, where increasing values
imply better performance. These scores are computed in five steps:
(i) computation of a statistical metric,
(ii) nondimensionalization,
(iii) conversion to unit interval,
(iv) spatial integration, and
(v) averaging scores computed from different statistical metrics.
The latter includes the bias, root-mean-square error, phase shift,
inter-annual variability, and spatial distribution. The corresponding equations
are documented in amber-package
.
1 2 3 4 5 6 | scores.fluxnet.site(long.name, mod.csv, mod.csv.path, ref.csv, mod.id,
ref.id, unit.conv.mod, unit.conv.ref, variable.unit, sites,
score.weights = c(1, 2, 1, 1, 1), my.xlim = c(-180, 180),
my.ylim = c(-60, 85), plot.width = 8, plot.height = 3.8,
numCores = 2, outputDir = FALSE, phaseMinMax = "phaseMax",
myCex = 0.7)
|
long.name |
A string that gives the full name of the variable, e.g. 'Gross primary productivity' |
mod.csv |
A string that gives the name of the model output in csv format, e.g. 'gpp_monthly.csv' |
mod.csv.path |
A string that gives the path to the model output for site-level runs |
ref.csv |
A string that gives the path and name of the csv file that contains the reference data output, e.g. '/home/reference_gpp.csv'. The columns of this file should contain latitude, longitude, date, variable of interest, and site name. |
mod.id |
A string that identifies the source of the reference data set, e.g. 'CanESM2' |
ref.id |
A string that identifies the source of the reference data set, e.g. 'MODIS' |
unit.conv.mod |
A number that is used as a factor to convert the unit of the model data, e.g. 86400 |
unit.conv.ref |
A number that is used as a factor to convert the unit of the reference data, e.g. 86400 |
variable.unit |
A string that gives the final units using LaTeX notation, e.g. 'gC m$^-2$ day$^-1$' |
sites |
A vector of strings that give the fluxnet site names, e.g. c('AU-Tum','BR-Sa1','CA-Qfo') |
score.weights |
R object that gives the weights of each score (S_{bias}, S_{rmse}, S_{phase}, S_{iav}, S_{dist}) that are used for computing the overall score, e.g. c(1,2,1,1,1) |
my.xlim |
An R object that gives the longitude range that you wish to plot, e.g. c(-180, 180) |
my.ylim |
An R object that gives the longitude range that you wish to plot, e.g. c(-90, 90) |
plot.width |
Number that gives the plot width, e.g. 8 |
plot.height |
Number that gives the plot height, e.g. 4 |
numCores |
An integer that defines the number of cores, e.g. 2 |
outputDir |
A string that gives the output directory, e.g. '/home/project/study'. The output will only be written if the user specifies an output directory. |
phaseMinMax |
A string (either 'phaseMax' or 'phaseMin') that determines whether to assess the seasonal peak as a maximum or a minimum. The latter may be appropriate for variables that tend to be negative, such as net longwave radiation or net ecosystem exchange. |
myCex |
A number that determines the size of the dots in the Figure. Default is set to 0.7. |
(1) Figures in PDF format that show maps of the model data at the location of FLUXNET sites (mean, mod.mean; interannual-variability, mod.iav; month of annual cycle maximum, mod.max.month), the reference data (mean, ref.mean; interannual-variability, ref.iav; month of annual cycle maximum, ref.max.month), statistical metrics (bias, bias; centralized root mean square error, crmse; time difference of the annual cycle maximum, phase), and scores (bias score, bias.score; root mean square error score, rmse.score; inter-annual variability score iav.score; annual cycle score (phase.score).
(2) Four text files: (i) score values and (ii) score inputs for each individual site, and (iii) score values and (iv) score inputs averaged across sites. when averaging over all station.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | library(amber)
library(classInt)
library(doParallel)
library(foreach)
library(Hmisc)
library(latex2exp)
library(ncdf4)
library(parallel)
library(raster)
library(rgdal)
library(rgeos)
library(scico)
library(sp)
library(stats)
library(utils)
library(viridis)
library(xtable)
long.name <- 'Gross primary productivity'
mod.csv <- 'gpp_monthly.csv'
mod.csv.path <- system.file('extdata/siteLevelRun', package = 'amber')
ref.csv <- system.file('extdata/referenceRegular', 'gpp_monthly_fluxnet.csv', package = 'amber')
mod.id <- 'CLASSIC-Sitelevel' # define a model experiment ID
ref.id <- 'FLUXNET' # give reference dataset a name
unit.conv.mod <- 86400*1000 # optional unit conversion for model data
unit.conv.ref <- 1 # optional unit conversion for reference data
variable.unit <- 'gC m$^{-2}$ day$^{-1}$' # unit after conversion (LaTeX notation)
sites <- c('AU-Tum','CA-TPD', 'US-WCr')
# Short version using default settings:
scores.fluxnet.site(long.name, mod.csv, mod.csv.path, ref.csv, mod.id, ref.id,
unit.conv.mod, unit.conv.ref, variable.unit, sites)
# Additional parameters:
score.weights <- c(1,2,1,1,1) # score weights of S_bias, S_rmse, S_phase, S_iav, S_dist
my.xlim <- c(-180, 180)
my.ylim <- c(-60, 85)
plot.width <- 8
plot.height <- 3.8
numCores <- 2
scores.fluxnet.site(long.name, mod.csv, mod.csv.path, ref.csv, mod.id, ref.id,
unit.conv.mod, unit.conv.ref, variable.unit, sites, score.weights,
my.xlim, my.ylim, plot.height, numCores)
# To zoom into a particular region:
scores.fluxnet.site(long.name, mod.csv, mod.csv.path, ref.csv, mod.id, ref.id,
unit.conv.mod, unit.conv.ref, variable.unit, sites,
my.xlim = c(-150, -60), my.ylim = c(20, 60), plot.width = 6, plot.height = 3.8)
#donttest
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.