metaclipR.AnomalyCalculation: Directed metadata graph construction for Anomaly...

Description Usage Arguments Details Author(s) References See Also Examples

Description

Build a directed metadata graph describing an anomaly Transformation on a climate4R grid

Usage

1
2
3
metaclipR.AnomalyCalculation(graph, package = "transformeR",
  version = "1.3.2", fun = "localScaling", arg.list = NULL,
  referenceGraph = NULL)

Arguments

graph

An output from a previous metaclipR function containing a list with the i-graph class object containing the input grid whose anomaly is to be computed, plus the terminal node from which the Anomaly Step will hang

package

package

version

version

fun

function name. Unused (set to "localScaling")

arg.list

Argument list. See details

referenceGraph

An output from a previous metaclipR function containing a list with the i-graph class object containing the reference Transformation-class object used as base to compute the climatology, plus the name of its terminal node

Details

This function takes as reference the semantics defined in the Data Source and Transformation ontology defined in the Metaclip Framework (http://metaclip.predictia.es/).

Argument list

The following list of arguments is required to define an anomaly:

The different arguments are explained in the the help page of localScaling. More complex setups are possible with localScaling, as well as local bias correction if a ref is supplied, but these cases are not addressed in the particular case of anomaly calculation.

Author(s)

D. San Martín, J. Bedia

References

METACLIP web page at Predictia

Climate4R page at University of Cantabria

See Also

Other transformation: metaclip.graph.Command, metaclipR.Aggregation, metaclipR.Climatology, metaclipR.Dataset, metaclipR.Ensemble, metaclipR.Regridding, metaclipR.etccdi

Examples

 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
require(transformeR)
require(igraph)
pkg <- "transformeR"
v <- "1.1.1"
# Assume a given hindcast DatasetSubset: 
data("CFS_Iberia_psl")
# In this example it is assumed that the 1983-1990 partition is the hindcast
# (the reference period used to compute the anomaly), and that the 2002 subset
# is the operational forecast for that year. 
# Note that the dataset is daily:
getTimeResolution(CFS_Iberia_psl)

# First, a dataset subset of just 3 members is created as example. The DatasetSubset initializes
# the graph in this example

psl <- subsetGrid(CFS_Iberia_psl, members = 1:3)
metadata <- metaclipR.DatasetSubset(package = pkg,
                                    version = v,
                                    fun = "subsetGrid",
                                    output = "psl",
                                    arg.list = list("members" = 1:3))
                                         
plot.igraph(metadata$graph, vertex.size = 5, edge.arrow.size = 0.1)
                                         
# Annual data are calculated via aggregation: 

CFS.psl.annual <- aggregateGrid(psl,
                                aggr.m = list(FUN = "mean", na.rm = TRUE),
                                aggr.y = list(FUN = "mean", na.rm = TRUE))
# and the corresponding metadata added to the graph:
metadata <- metaclipR.Aggregation(graph = metadata,
                                  package = pkg,
                                  version = v,
                                  fun = "aggregateGrid",
                                  arg.list = list("aggr.m" = list(FUN = "mean", na.rm = TRUE),
                                                  "aggr.y" = list(FUN = "mean", na.rm = TRUE)))

plot.igraph(metadata$graph, vertex.size = 5, edge.arrow.size = 0.1)

# Next the baseline period used as reference for anomaly calculation is subset:
ref <- subsetGrid(CFS.psl.annual, years = 1983:1990)

metadata <- metaclipR.DatasetSubset(package = pkg,
                                    graph = metadata,
                                    version = v,
                                    fun = "subsetGrid",
                                    output = "ref",
                                    arg.list = list("years" = 1983:1990))
                                         
plot.igraph(metadata$graph, vertex.size = 5, edge.arrow.size = 0.1)

# The same is done for the "fake" operative forecast for 2002, 
#     assumed to come from a different dataset:
fcst <- subsetGrid(CFS.psl.annual, years = 2002)
# THE FORECAST IS ADDED TO A NEW GRAPH. However,
# no linking property between hindcast and forecast is indicated 
metadata2 <- metaclipR.DatasetSubset(package = pkg,
                                     version = v,
                                     arg.list = list("years" = 2002),
                                     output = "fcst")
                                          
plot.igraph(metadata2$graph, vertex.size = 5, edge.arrow.size = 0.1)

# The function localScaling is used to compute anomalies. 
# In its default setup, it subtracts the climatology (mean) of the input grid:
anom <- localScaling(grid = fcst,
                     base = ref,
                     ref = NULL,
                     time.frame = "none",
                     by.member = TRUE)
# This is the argument list (the data arrays are indicated as character 
     # strings to avoid  a congested graph):
arg.list = list("grid" = "fcst",
                "base" = "ref",
                "ref" = NULL,
                "clim.fun" = list(FUN = mean, na.rm = TRUE),
                "by.member" = TRUE,
                "time.frame" = "none")

# The metadata of the anomaly calculation is next encoded. 
# Note that two different graphs are used as input:
#  i) The graph containing the steps to produce the baseline data, 
#         used as reference to compute the anomalies
#  ii) The graph containing the data upon which the anomalies are to be calculated

out <- metaclipR.AnomalyCalculation(graph = metadata2,
                                    package = pkg,
                                    version = v,
                                    fun = "localScaling",
                                    arg.list = arg.list,
                                    referenceGraph = metadata)

plot.igraph(out$graph, vertex.size = 5, edge.arrow.size = 0.1)

Predictia/metaclipR documentation built on May 14, 2019, 6:07 a.m.