corrMat.VALUE: Correlation matrix for paper Figures 4 and 5 on spatial...

View source: R/corrMat.VALUE.R

corrMat.VALUER Documentation

Correlation matrix for paper Figures 4 and 5 on spatial validation

Description

Computes the cross correlation matrices between stations that serve as input for plotting functions

Usage

corrMat.VALUE(stationObj, predictionObj = NULL, season = c("annual", "DJF",
  "MAM", "JJA", "SON"), method = "pearson", type = "after",
  max.na.prop = 0.25, deseason = TRUE, window.width = 31)

Arguments

stationObj

An R-VALUE object containing station data (as returned by loadValueStations).

predictionObj

A R-VALUE predictions object as loaded by loadValuePredictions. Default to NULL, meaning that the correlation matrix is done on the observations.

season

Character string indicating the target season. Accepted values are c("annual", "DJF", "MAM", "JJA", "SON"). Several choices in the same request are accepted (all are computed by default).

method

Correlation method, passed to the cor function. Default is "spearman", but "pearson" and "kendall" are also accepted.

type

Type of aggregation in the case of multiple realizations. Should the aggregation of multiple members be performed "before" or "after" (the default) computing the correlations?. Ignored in the case of observations and deterministic predictions.

max.na.prop

Maximum allowed proportion of missing data (Default to 0.25). See details

deseason

Logical. Should the seasonal cycle from the input data series be removed?. See details.

window.width

Used if deseason = TRUE. Integer number indicating the width, in days, of the window used for moving average computation of the reference daily climatology. Default to 31 days. See details.

Details

Seasonal cycle removal

A (circular) moving average daily climatology can be automatically calculated for each data series, considering a specific window width (31 days by default, centered around lag 0). This is used for removing the seasonal cycle. Alternatively, the predictionObj or stationObj can be passed to the function adter applying deseason.VALUE.

Missing data treatment

An additional argument, max.na.prop, allows to specify the maximum number of missing values allowed, being ommited from the analysis those data series above the threshold. Note that this argument is applied on a seasonal basis, so correlation matrices for different seasons may differ in their dimension. Missing ata filering can be disabled by setting the maximum allowed proportion of missing data to 1.

Value

A list of 2D matrices. The length of the list corresponds to the periods indicated in the season argument (default to 5, annual and the four standard WMO seasons). Matrix attributes indicate -in the row/column order they appear- the station names, id codes, and their geographical coordinates. Global attributes provide other method details.

Author(s)

J. Bedia

Examples

## Not run: 
obs.file <- file.path(find.package("R.VALUE"),"example_datasets","VALUE_ECA_86_v2.zip")
stationObj <- loadValueStations(obs.file, "precip")
predictions.file <- file.path(find.package("R.VALUE"),"example_datasets",
                                  "example_predictions_precip_portal_exp1a_deterministic.zip")
prd <- loadValuePredictions(stationObj, predictions.file)                                  
# Correlation matrix of annual data:                                  
annual <- corrMat.VALUE(stationObj, prd, season = "annual")
# Correlation matrix for winter and summer:
djfjja <- corrMat.VALUE(stationObj, prd, season = c("DJF","JJA"))

## End(Not run)

SantanderMetGroup/R_VALUE documentation built on July 4, 2023, 4:27 a.m.