Description Usage Arguments Value Examples
View source: R/scores.runoff.R
This function compares modelled runoff and measured streamflow
on an annual basis for 50 river basins. Modelled runoff is converted to
streamflow by spatially integrating annual runoff across each river basins.
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,
inter-annual variability, and spatial distribution. The corresponding equations
are documented in amber-package
. Contrary to the function
scores.grid.time, no phase score is computed since data is evaluated on
an annual basis. Assessing annual rather than monthly values causes the standard
deviation sigma_{ref}(λ, φ) to be very small. For this reason,
the relative errors for runoff are computed with repect to the mean rather than
the standard deviation:
(ii) \ \varepsilon_{bias}=|bias(λ, φ)|/\overline{v_{ref}}(λ, φ) (ii) \ \varepsilon_{rmse}(λ, φ)=crmse(λ, φ)/\overline{v_{ref}}(λ, φ).
1 2 3 4 5 6 7 | scores.runoff(long.name, nc.mod, nc.ref, nc.basins, mod.id, ref.id,
unit.conv.mod, unit.conv.ref, variable.unit, score.weights = c(1, 2, 1,
1, 1),
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, outputDir = FALSE,
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' |
nc.ref |
A string that gives the path and name of the netcdf file that contains the reference data output, e.g. '/home/reference_gpp.nc' |
nc.basins |
A string that gives the path and name of the netcdf file that contains the river basins, e.g. '/home/basins.nc' |
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) |
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 |
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 |
subcaption |
A string that defines the subcaption of the figure, e.g. '(a)'. |
(1) Figures in PDF format that show global maps of the model data (mean, mod.mean; interannual-variability, mod.iav), the reference data (mean, ref.mean; interannual-variability, ref.iav), statistical metrics (bias, bias; centralized root mean square error, crmse), and scores (bias score, bias.score; root mean square error score, rmse.score; inter-annual variability score iav.score).
(2) Three text files: (i) score values and (ii) score inputs averaged across the entire grid, and (iii) score values for each individual river basin.
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 | 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 <- 'Streamflow'
nc.mod <- system.file('extdata/modelRegular', 'mrro_monthly.nc', package = 'amber')
nc.ref <- system.file('extdata/referenceRegular', 'runoff.nc', package = 'amber')
nc.basins <- system.file('extdata/referenceRegular', 'basins.nc', package = 'amber')
mod.id <- 'CLASSIC' # model name
ref.id <- 'GRDC' # give reference dataset a name
unit.conv.mod <- 86400 # optional unit conversion for model data
unit.conv.ref <- 86400 # optional unit conversion for reference data
variable.unit <- 'kg m$^{-2}$ day$^{-1}$' # unit after conversion (LaTeX notation)
score.weights <- c(1,2,1,1,1) # define score weights
scores.runoff(long.name, nc.mod, nc.ref, nc.basins, mod.id, ref.id, unit.conv.mod,
unit.conv.ref, variable.unit, score.weights)
#donttest
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.