wrapperFUN: Wrapper function to launch the validation

View source: R/wrapperFUN.R

wrapperFUNR Documentation

Wrapper function to launch the validation

Description

Launches the VALUE validation framework according to the arguments passed by the database.

Usage

wrapperFUN(
  metric = c("obs", "pred", "measure"),
  names = NULL,
  season = c("annual", "DJF", "MAM", "JJA", "SON"),
  member.aggregation = "none",
  n.mem = NULL,
  index.fun = NULL,
  measure.fun = NULL,
  index.args = NULL,
  measure.args = NULL,
  o = o,
  p = p,
  processes = data.frame(),
  processNames = c(),
  na.prop = 1
)

Arguments

metric

Character vector.

names

Character vector of the same length than metric. Names of the indices/measures to be applied

season

Character vector defining the target season(s). Default to annual + 4 standard seasons.

member.aggregation

Character vector of length one. What aggregation function should be applied to multiple realizations before computing the indices?. Default to "none", meaning that the indices are computed in a member-wise basis, and only after that the index values are aggregated to compute the measure. The only additional option currently used is "mean", for cases when the realizations are averaged before computing the index. Ignored for observations and deterministic predictions.

n.mem

Number of members to be considered for validation. Default (n.mem = NULL) to all members, (or 1 in case of deterministic predictions). Note that the number of members selected are used for member.aggregation, independently of whether this aggregation is performed before or after.

index.fun

A character vector with the name of the R function that computes the index.

measure.fun

A character vector with the name of the R function that computes the measure.

index.args

A list with additional arguments passed to index.fun. It contains a key-value list for each additional argument.

measure.args

Same as index.args but for the measure function.

o

R object containing the observations as returned by loadStationData.

p

R object containing the predictions as returned by loadStationPredictions.

processes

processes

processNames

Labels identifying the processes

na.prop

Maximum allowable proportion of missing data. Default to 0.9

Details

The function is intended for internal use only, in order to launch the validation framework through the VALUE portal. It is not meant for extrenal users.

Value

A 3D array with labelled dimensions station, season and metric

Note

This function is not envisaged to be directly called by the user. It is internally called by the validation portal.

Author(s)

J. Bedia, D. San Martín, M. Tuni

Examples

## Not run: 
# Load observations
obs.file <- file.path(find.package("VALUE"), "example_datasets", "VALUE_ECA_86_v2.zip")
o <- loadValueStations(obs.file, var = "tmin")
prdfile <- list.files(file.path(find.package("VALUE"), "example_datasets"),
                      pattern = "example_predictions_tmin_portal_exp1a_deterministic",
                      full.names = TRUE)
# Load predictions
p <- loadStationPredictions(o, predictions.file = prdfile)
# Example: computing correlation. Seasonal cycle removal is applied
vno <- wrapperFUN(metric = c('measure'),
                  names = c('measure'),
                  season = c('annual','DJF','MAM','JJA','SON'),
                  member.aggregation = 'none',
                  index.fun = NULL,
                  measure.fun = 'measure.cor.R',
                  index.args = NULL,
                  measure.args = list('method' = 'pearson','deseason' = TRUE),
                  o = o,
                  p = p)
str(vno)

## End(Not run)

SantanderMetGroup/VALUE documentation built on July 8, 2023, 7:03 a.m.