plotProbcast {ensembleBMA} | R Documentation |
Surface plots for forecast information.
Description
Produces contour, image, or perspective plot of a forecast using loess prediction on a grid.
Usage
plotProbcast( forecast, longitude, latitude, nGrid = 65,
type = c("image", "contour", "persp"), ...,
interpolate = FALSE, span = 0.75, maps = NULL)
Arguments
forecast |
Numeric vector of forecasts. |
longitude |
Numeric vector giving the longitude of each forecast location. |
latitude |
Numeric vector giving the latitude of each forecast location. |
nGrid |
Number of grid points for |
type |
A character string indicating the desired plot type.
Should be one of either |
... |
Additional arguments to be passed to the plotting method. |
interpolate |
A logical variable indicating whether or not a |
span |
Smoothing parameter for |
maps |
A logical value indicating whether or not to include
a map outline. The default is to include an outline
if |
Details
If the fields
library is loaded, a legend (and optionally
a map outline) will be included in image plots.
Value
An image, contour, or perspective plot of the forecast.
References
C. Fraley, A. E. Raftery, T. Gneiting and J. M. Sloughter,
ensembleBMA
: An R
Package for Probabilistic Forecasting
using Ensembles and Bayesian Model Averaging,
Technical Report No. 516R, Department of Statistics, University of
Washington, 2007 (revised 2010).
See Also
Examples
data(srft)
labels <- c("CMCG","ETA","GASP","GFS","JMA","NGPS","TCWB","UKMO")
srftData <- ensembleData( forecasts = srft[,labels],
dates = srft$date, observations = srft$obs,
latitude = srft$lat, longitude = srft$lon,
forecastHour = 48, initializationTime = "00")
## Not run: # R check
bmaFit <- ensembleBMA( srftData, date = "2004012900", trainingDays = 25,
model = "normal")
bmaForc <- quantileForecast( bmaFit, srftData, date = "2004012900",
quantiles = c(.1, .5, .9))
obs <- srftData$date == "2004012900"
lat <- srftData$latitude[obs]
lon <- srftData$longitude[obs]
plotProbcast( bmaForc[,"0.5"], lat, lon,
type = "contour", interpolate = TRUE)
title("Median Forecast")
plotProbcast( srftData$obs[obs], lat, lon,
type = "contour", interpolate = TRUE)
title("Observed Surface Temperature")
data(srftGrid)
memberLabels <- c("CMCG","ETA","GASP","GFS","JMA","NGPS","TCWB","UKMO")
srftGridData <- ensembleData(forecasts = srftGrid[,memberLabels],
latitude = srftGrid[,"latitude"], longitude = srftGrid[,"longitude"],
forecastHour = 48, initializationTime = "00")
gridForc <- quantileForecast( bmaFit, srftGridData,
date = "2004021400", quantiles = c( .1, .5, .9))
library(fields)
plotProbcast(gridForc[,"0.5"],lon=srftGridData$lon,
lat=srftGridData$lat,type="image",col=rev(rainbow(100,start=0,end=0.85)))
title("Median Grid Forecast for Surface Temperature", cex = 0.5)
probFreeze <- cdf( bmaFit, srftGridData, date = "2004021400",
value = 273.15)
plotProbcast(probFreeze, lon=srftGridData$lon, lat=srftGridData$lat,
type="image",col=gray((32:0)/32))
title("Probability of Freezing", cex = 0.5)
## End(Not run)