-
Notifications
You must be signed in to change notification settings - Fork 1
/
res_time.R
201 lines (185 loc) · 5.23 KB
/
res_time.R
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
##' Plot residuals versus time
##'
##' These plots have \code{RES} on the y axis and
##' some time-related column on the x-axis, including \code{TIME},
##' \code{TAD}, or \code{TAFD}. Uses \code{\link{y_time}} to create the plots.
##' Please see that help topic and details here for other arguments to
##' customize the plot.
##'
##' @param df data set to plot
##' @param x x-axis data in \code{\link{col_label}} format
##' @param y y-axis data in \code{\link{col_label}} format
##' @param ... passed to \code{\link{y_time}} and
##' \code{\link{layer_hs}}
##'
##'
##' @seealso \code{\link{y_time}}, \code{\link{geom_3s}}
##'
##' @details
##' Plots are generated using \code{\link{y_time}},
##' which then calls \code{\link{scatt}}.
##'
##' By default, the time unit is assumed
##' to be hours (\code{hr}). See the \code{xunit} argument
##' to \code{\link{y_time}} to change the time unit.
##'
##' See the \code{xby} argument to \code{\link{y_time}} for a
##' convenient way to change the breaks for the x-axis (time).
##'
##' Since this function creates a scatter plot,
##' both the \code{x} and \code{y} columns must
##' be numeric.
##'
##' @examples
##' df <- pmplots_data_obs()
##'
##' cwresi_time(df)
##'
##' @return A single plot.
##'
##' @export
res_time <- function(df, x = pm_axis_time(), y = pm_axis_res(), ...) {
out <- y_time(df, x = x, y = y, ...)
layer_hs(out, ...)
}
##' @export
##' @rdname res_time
res_tafd <- function(df, x = pm_axis_tafd(), y = pm_axis_res(), ...) {
res_time(df, x = x, y = y, ...)
}
##' @export
##' @rdname res_time
res_tad <- function(df, x = pm_axis_tad(), y = pm_axis_res(), ...) {
res_time(df, x = x, y = y, ...)
}
##' Plot weighted residuals versus time
##'
##' Uses \code{\link{y_time}} to create the plots. Please see that
##' help topic and details here for other arguments to customize the plot.
##'
##' @inheritParams res_time
##' @inherit res_time details
##'
##' @param ... passed to \code{\link{res_time}} and eventually to
##' \code{\link{y_time}}
##'
##' @examples
##' df <- pmplots_data_obs()
##'
##' wres_time(df)
##'
##' @seealso \code{\link{res_time}}, \code{\link{cwres_time}},
##' \code{\link{npde_time}}
##'
##' @return A single plot.
##'
##' @rdname wres_time
##' @export
##'
wres_time <- function(df, x = pm_axis_time(), y = pm_axis_wres(), ...) {
res_time(df, x = x, y = y, ...)
}
##' @export
##' @rdname wres_time
wres_tafd <- function(df, x = pm_axis_tafd(), y = pm_axis_wres(), ...) {
wres_time(df, x = x, y = y, ...)
}
##' @export
##' @rdname wres_time
wres_tad <- function(df, x = pm_axis_tad(), y = pm_axis_wres(), ...) {
wres_time(df, x = x, y = y, ...)
}
##' Plot conditional weighted residuals versus time
##'
##' Uses \code{\link{y_time}} to create the plots. Please see that
##' help topic and details here for other arguments to customize the plot.
##'
##' @inheritParams res_time
##' @inherit res_time details
##'
##' @param ... passed to \code{\link{res_time}} and eventually to
##' \code{\link{y_time}}
##'
##' @examples
##' df <- pmplots_data_obs()
##'
##' cwresi_time(df)
##'
##' @seealso \code{\link{res_time}}, \code{\link{wres_time}},
##' \code{\link{npde_time}}
##'
##' @return A single plot.
##'
##' @rdname cwres_time
##' @export
##'
cwres_time <- function(df, x = pm_axis_time(), y = pm_axis_cwres(), ...) {
if(no_cwres(df)) df <- supplement_cwres(df)
res_time(df, x = x, y = y, ...)
}
##' @export
##' @rdname cwres_time
cwres_tafd <- function(df, x = pm_axis_tafd(), y = pm_axis_cwres(), ...) {
if(no_cwres(df)) df <- supplement_cwres(df)
cwres_time(df, x = x, y = y, ...)
}
##' @export
##' @rdname cwres_time
cwres_tad <- function(df, x = pm_axis_tad(), y = pm_axis_cwres(), ...) {
if(no_cwres(df)) df <- supplement_cwres(df)
cwres_time(df, x = x, y = y, ...)
}
##' @export
##' @rdname cwres_time
cwresi_time <- function(df, x = pm_axis_time(), y = pm_axis_cwresi(), ...) {
cwres_time(df, x = x, y = y, ... )
}
##' @export
##' @rdname cwres_time
cwresi_tafd <- function(df, x = pm_axis_tafd(), y = pm_axis_cwresi(), ...) {
cwres_tafd(df, x = x, y = y, ... )
}
##' @export
##' @rdname cwres_time
cwresi_tad <- function(df, x= pm_axis_tad(), y = pm_axis_cwresi(), ...) {
cwres_tad(df, x = x, y = y, ... )
}
##' Plot NPDE versus time
##'
##' Uses \code{\link{y_time}} to create the plots. Please see that
##' help topic and details here for other arguments to customize the plot.
##'
##' @inheritParams res_time
##' @inherit res_time details
##'
##' @param ... passed to \code{\link{res_time}} and eventually to
##' \code{\link{y_time}}
##' @param hline a list of arguments to pass to \code{geom_hline} specifying
##' aesthetics to use
##'
##' @examples
##' df <- pmplots_data_obs()
##'
##' npde_time(df)
##'
##' @seealso \code{\link{res_time}}, \code{\link{cwres_time}},
##' \code{\link{wres_time}}
##'
##' @return A single plot.
##'
##' @rdname npde_time
##' @export
npde_time <- function(df, x= pm_axis_time(), y = pm_axis_npde(), ...,
hline = npde_ref()) {
res_time(df, x = x, y = y, hline = hline, ...)
}
##' @rdname npde_time
##' @export
npde_tad <- function(df, x = pm_axis_tad(), y = pm_axis_npde(), ...) {
npde_time(df, x = x, y = y, ...)
}
##' @rdname npde_time
##' @export
npde_tafd <- function(df, x = pm_axis_tafd(), y = pm_axis_npde(), ...) {
npde_time(df, x = x, y = y, ...)
}