Scores for FLUXNET reference data in CSV format
This function compares model output against
FLUXNET measurements in CSV format. 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
.
scores.fluxnet.csv(long.name, nc.mod, ref.csv, mod.id, ref.id, unit.conv.mod, unit.conv.ref, variable.unit, score.weights = c(1, 2, 1, 1, 1), rotate.me = TRUE, irregular = FALSE, my.projection = "+proj=longlat +ellps=WGS84", shp.filename = system.file("extdata/ne_110m_land/ne_110m_land.shp", package = "amber"), my.xlim = c(-180, 180), my.ylim = c(-60, 85), plot.width = 8, plot.height = 3.8, numCores = 2, outputDir = FALSE, variable.name = FALSE, numberOfMonths = 36, phaseMinMax = "phaseMax", meanPerGridCell = TRUE, myCex = 0.5, subcaption = "")
long.name |
A string that gives the full name of the variable, e.g. 'Gross primary productivity' |
nc.mod |
A string that gives the path and name of the netcdf file that contains the model output, e.g. '/home/model_gpp.nc' |
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$' |
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) |
rotate.me |
logical: TRUE if you want longitudes to range from -180 to 180 degrees and FALSE if you want longitudes to range from 0 to 360 degrees |
irregular |
logical: TRUE if data is on an irregular grid and FALSE if data is on a regular grid |
my.projection |
A string that gives the projection of the irregular grid |
shp.filename |
A string that gives the coastline shapefile |
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. |
variable.name |
A string with the variable name, e.g. 'GPP'. If FALSE, the variable name stored in the NetCDF file will be used instead. Default is FALSE. |
numberOfMonths |
An integer that gives the mimimum number of months that each site should have, e.g. 60. All sites with fewer months will be excluded. |
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. |
meanPerGridCell |
Logical. If TRUE, then values from different sites that are located in the same grid cell are averaged. Default is set to TRUE. |
myCex |
A number that determines the size of the dots in the Figure. |
subcaption |
A string that defines the subcaption of the figure, e.g. '(a)'. |
(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.
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) # (1) Global plots on a regular grid long.name <- 'Gross primary productivity' nc.mod <- system.file('extdata/modelRegular', 'gpp_monthly.nc', package = 'amber') ref.csv <- system.file('extdata/referenceRegular', 'gpp_monthly_fluxnet.csv', package = 'amber') mod.id <- 'CLASSIC' # 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) # Short version using default settings: scores.fluxnet.csv(long.name, nc.mod, ref.csv, mod.id, ref.id, unit.conv.mod, unit.conv.ref, variable.unit) # To zoom into a particular region: scores.fluxnet.csv(long.name, nc.mod, ref.csv, mod.id, ref.id, unit.conv.mod, unit.conv.ref, variable.unit, score.weights = c(1, 2, 1, 1, 1), my.xlim = c(-150, -60), my.ylim = c(20, 60), plot.width = 6, plot.height = 3.8) # (2) Regional plots on a rotated grid nc.mod <- system.file('extdata/modelRotated', 'gpp_monthly.nc', package = 'amber') ref.csv <- system.file('extdata/referenceRegular', 'gpp_monthly_fluxnet.csv', package = 'amber') mod.id <- 'CLASSIC' # 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) score.weights <- c(1,2,1,1,1) # score weights of S_bias, S_rmse, S_phase, S_iav, S_dist rotate.me <- FALSE irregular <- TRUE my.projection <-'+proj=ob_tran +o_proj=longlat +o_lon_p=83. +o_lat_p=42.5 +lon_0=263.' # shp.filename <- system.file('extdata/ne_50m_admin_0_countries/ne_50m_admin_0_countries.shp', # package = 'amber') shp.filename <- system.file("extdata/ne_110m_land/ne_110m_land.shp", package = "amber") my.xlim <- c(-171, 0) # longitude range that you wish to plot my.ylim <- c(32, 78) # latitude range that you wish to plot plot.width <- 7 plot.height <- 3.8 numCores <- 2 scores.fluxnet.csv(long.name, nc.mod, ref.csv, mod.id, ref.id, unit.conv.mod, unit.conv.ref, variable.unit, score.weights, rotate.me, irregular, my.projection, shp.filename, my.xlim, my.ylim) #donttest
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.