plotfields {ProbForecastGOP} | R Documentation |
Plot weather fields.
plotfields(field, x.lim, y.lim, title)
field |
numeric square matrix containing the values of the weather field on a grid. |
x.lim |
numeric vector giving the smallest and the largest longitude to be displayed. |
y.lim |
numeric vector giving the smallest and the largest latitude to be displayed. |
title |
character string with the title for the plot. |
The function returns a graphical display of the weather field on a region delimited by the lower and upper bound for the longitude and the latitude.
This function uses the package fields.
Gel, Y., Raftery, A. E., Gneiting, T., Berrocal, V. J. veronica@stat.washington.edu.
The package fields for display of spatial data, and US
and world
for a map of the US and the world.
## Loading data library(fields) library(RandomFields) data(slp) data(gridlong) data(gridlat) data(forecast.grid) day <- slp$date.obs id <- slp$id.stat coord1 <- slp$lon.stat coord2 <- slp$lat.stat obs <- slp$obs forecast <- slp$forecast coord1.grid <- gridlong$gridded.long coord2.grid <- gridlat$gridded.lat forecast.grid <- forecast.grid$gridded.forecast ## Computing the empirical variogram variogram <- Emp.variog(day,obs,forecast,id,coord1,coord2,cut.points=NULL, max.dist=NULL,nbins=NULL) ## Estimating parameters param.est <- Variog.fit(variogram,"exponential",max.dist.fit=NULL, init.val=NULL,fix.nugget=FALSE) ## Simulating realizations of the weather random field simul <- Field.sim(obs, forecast, coord1.grid, coord2.grid, forecast.grid, variog.model="exponential", param.est=c(param.est$nugget,param.est$variance, param.est$range), n.sim=4, n.displ=0, qt.displ=c(10,50,90)) ##Plotting one of the simulated weather random fields par(mfrow=c(1,1)) plotfields(simul$sim.fields[,,1],x.lim=c(min(coord1.grid),max(coord1.grid)), y.lim=c(min(coord2.grid),max(coord2.grid)),title="Simulated weather field") ## Plotting one of the percentiles of the weather field par(mfrow=c(1,1)) plotfields(simul$pct.fields[,,1],x.lim=c(min(coord1.grid),max(coord1.grid)), y.lim=c(min(coord2.grid),max(coord2.grid)),title="10th percentile")