Learn R Programming

SpatialVx (version 1.0-2)

wavePurifyVx: Apply Traditional Forecast Verification After Wavelet Denoising

Description

Apply traditional forecast verification after wavelet denoising ala Briggs and Levine (1997).

Usage

wavePurifyVx( x, climate = NULL, which.stats = c("bias",
    "ts", "ets", "pod", "far", "f", "hk", "mse"), thresholds = NULL,
    rule = ">=", return.fields = FALSE, verbose = FALSE, ...)

# S3 method for SpatialVx wavePurifyVx( x, climate = NULL, which.stats = c("bias", "ts", "ets", "pod", "far", "f", "hk", "mse"), thresholds = NULL, rule = ">=", return.fields = FALSE, verbose = FALSE, ..., time.point = 1, obs = 1, model = 1 )

# S3 method for default wavePurifyVx( x, climate = NULL, which.stats = c("bias", "ts", "ets", "pod", "far", "f", "hk", "mse"), thresholds = NULL, rule = ">=", return.fields = FALSE, verbose = FALSE, ...)

# S3 method for wavePurifyVx plot(x, ..., col = c("gray", tim.colors(64)), zlim, mfrow, horizontal = TRUE, type = c("stats", "fields") )

# S3 method for wavePurifyVx summary(object, ...)

Value

A list object of class “wavePurifyVx” is returned with possible components (depending on what is supplied in the arguments, etc.):

X2,Y2

m by n matrices of the denoised verification and forecast fields, resp. (only if return.fields is TRUE).

thresholds

q by 2 matrix of thresholds applied to the forecast (first column) and verification (second column) fields, resp. If climate is not NULL, then the same thresholds for the forecast field are applied to the climatology.

qs

If object and thresholds are NULL, and statistics other than MSE or ACC are desired, then this will be created along with the thresholds, and is just a character version of the trhesholds.

args

list object containing all the optional arguments passed into ..., and the value of J used (e.g., even if not passed into ...).

bias,ts,ets,pod,far,f,hk,mse,acc

numeric vectors of length q (i.e., the number of thresholds) giving the associated verification statistics.

Arguments

x

For wavePurifyVx, either a list object of class “SpatialVx”, or a list with only two components consisting of m by n matrices giving the verification and forecast fields, resp., or a list with named components “X” and “Xhat”.

For plot.wavePurifyVx, list object as output from wavePurifyVx.

object

list object as returned by wavePurifyVx.

climate

m by n matrix defining a climatology field. If not NULL, then the anamoly correlation coefficient will be applied to the wavelet denoised fields.

which.stats

character describing which traditional verification statistics to calculate on the wavelet denoised fields. This is the argument passed to the argument of the same name in vxstats.

thresholds

Either a numeric vector or a list with components named “X” and “Xhat” giving thresholds used to define events for all of the verification statistics except MSE. However, if supplied or other statistics are to be computed, then MSE will be calculated for the fields at values >= thresholds. If only MSE is to be computed, and thresholds is NULL, then no thresholding is applied. If NULL, and any of the statistics besides MSE are to be calculated, then default values of the 0, 0.1, 0.25, 0.33, 0.5, 0.66, 0.75, 0.9 and 0.95 quantiles (for each field, so that the thresholds may differ between fields) are used. The same holds for anamoly correlation coefficient. The exception is that if the argument is null and x is a “SpatialVx” class object, then the thresholds are taken to be those associated with the “thresholds” attribute of this object.

rule

character string giving the threshold rule to be applied. See help file for thresholder function for more information.

return.fields

logical, should the denoised fields be returned (e.g., for subsequent plotting)?

time.point

numeric or character indicating which time point from the “SpatialVx” verification set to select for analysis.

obs, model

numeric indicating which observation/forecast model to select for the analysis.

verbose

logical, should progress information (including total run time) be printed to the screen?

col, zlim, horizontal

optional arguments to image, and/or fields functions poly.image and image.plot

mfrow

optionally set the plotting panel via mfrow (see help file for par). Default sets a rgion that will show all plots in one set of panels.

type

character string stating whether to plot the resulting statistics or the original fields along with their de-noised counter parts.

...

For wavePurifyVx, optional additional arguments to denoise.dwt.2d (or denoise.modwt.2d) from package waveslim. Note that if the argument J is not passed, then it will be determined as J=log2(min(m,n)). If the fields are dyadic, then the usual DWT is used, otherwise the maximal overlap DWT is used instead. For the plot and summary method functions, these are not used. Also passed to poly.image and image.plot for plotting routine for “fields” type plots when the “maps” attribute from the “SpatialVx” object is TRUE.

Author

Eric Gilleland

Details

If the fields are dyadic, then the denoise.dwt.2d function from package waveslim is applied to each field before calculating the chosen verification statistics. Otherwise denoise.modwt.2d from the same package is used. The result is that high-frequency fluctuations in the two fields are removed before calculating verification statistics so that the resulting statistics are less susceptible to small-scale errors (see Briggs and Levine, 1997). See Percival and Guttorp (1994) and Lindsay et al. (1996) for more on this type of wavelet analysis including maximal overlap DWT.

References

Briggs, W. M. and Levine, R. A. (1997) Wavelets and field forecast verification. Mon. Wea. Rev., 125, 1329--1341.

Lindsay, R. W., Percival, D. B. and Rothrock, D. A. (1996) The discrete wavelet transform and the scale analysis of the surface properties of sea ice. IEEE Transactions on Geoscience and Remote Sensing, 34 (3), 771--787.

Percival, D. B. and Guttorp, P. (1994) Long-memory processes, the Allan variance and wavelets. In Wavelets in Geophysics, Foufoula-Georgiou, E. and Kumar, P., Eds., New York: Academic, pp. 325--343.

See Also

denoise.dwt.2d, denoise.modwt.2d, waverify2d, mowaverify2d, waveIS, vxstats

Examples

Run this code
grid <- list( x= seq( 0,5,,100), y= seq(0,5,,100))
obj <- Exp.image.cov( grid=grid, theta=.5, setup=TRUE)
look <- sim.rf( obj)
look[ look < 0] <- 0
look <- zapsmall( look)
     
look2 <- sim.rf( obj)
look2[ look2 < 0] <- 0
look2 <- zapsmall( look2)

look3 <- sim.rf( obj) 
look3[ look3 < 0] <- 0 
look3 <- zapsmall( look3)

hold <- make.SpatialVx( look, look2, thresholds = c(0.1, 1),
            field.type = "random", units = "units")

plot( hold )

res <- wavePurifyVx( hold, climate = look3, return.fields = TRUE, verbose = TRUE )

plot(res, type="fields")
plot(res, type="stats")

summary(res)

if (FALSE) {
data( "UKobs6" )
data( "UKfcst6" )
data( "UKloc" )

hold <- surrogater2d( UKobs6, n=1, maxiter=50, verbose=TRUE)
hold <- matrix(hold, 256, 256)

UKobj <- make.SpatialVx( UKobs6, UKfcst6, thresholds = c(0.1, 2, 5, 10),
    loc = UKloc, map = TRUE, field.type = "Rainfall", units = "mm/h",
    data.name = "Nimrod", obs.name = "obs 6", model.name = "fcst 6" )

plot(UKobj ) 

look <- wavePurifyVx( object = UKobj, climate = hold,
    return.fields = TRUE, verbose = TRUE)

plot(look, type = "fields" )
plot(look, type = "stats" )

summary( look )

}

Run the code above in your browser using DataLab