# Field.sim: Simulation of weather random field In ProbForecastGOP: Probabilistic weather forecast using the GOP method

## Description

Simulates and displays realizations of forecast weather fields using a geostatistical model.

## Usage

 1 2 Field.sim(obs, forecast, coord1.grid, coord2.grid, forecast.grid,variog.model="exponential", param.est, n.sim=99, n.displ=4, qt.displ=c(10,50,90)) 

## Arguments

 obs numeric vector containing the observed weather quantity. forecast numeric vector containing the forecasted weather quantity. coord1.grid numeric vector containing the longitudes of the grid points for the forecast. coord2.grid numeric vector containing the latitudes of the grid points for the forecast. forecast.grid numeric vector containing the forecast grid. variog.model character string with the name of the variogram model to be used for the simulations. Implemented models are exponential, spherical, gauss, matern, and gencauchy. param.est numeric vector containing values for the parameters to use in the parametric variogram model. If the variog.model specified is exponential, spherical or gauss, then the parameters required are, in order, the nugget effect (a non-negative number), the variance and the range (both positive numbers). If the variog.model specified is gencauchy, the parameters required are, in order, the nugget effect (a non-negative number), the variance, the range (both positive numbers), the smoothness parameter a (a number in (0,2]), and the long-range parameter b (a positive number). If the variog.model specified is matern the parameters required are, in order, the nugget effect (a non-negative number), the variance, the range, and the smoothness parameter a (all positive numbers). For more details on the equation of the variogram models listed above, look below at the section "Details". n.sim number of realizations to be simulated. n.displ number of realizations to be displayed on screen. qt.displ numeric vector containing the quantiles to be displayed.

## Details

The function initially estimates the additive and multiplicative bias by regressing the forecasts on the observed weather quantity. Then it simulates and displays realizations of the weather random field using the specified geostatistical model. Percentiles of the weather random field are calculated using the specified variogram model.

- Parametric variogram models implemented -

Below are the equations of the parametric variogram models that can be implemented.

- exponential

γ(d) = ρ+σ^{2} \cdot (1-exp(- \frac{d}{r}))

where d is the distance, ρ is the nugget effect, σ^2 is the variance, and r is the range.

- spherical

γ(d) = ρ+σ^{2} \cdot (\frac{3}{2}\cdot\frac{d}{r}-\frac{1}{2} \cdot \frac{d^3}{r^3})

where d is the distance, ρ is the nugget effect, σ^2 is the variance, and r is the range.

- gauss

γ(d) = ρ+σ^{2} \cdot (1-exp(- \frac{d^2}{r^2} ))

where d is the distance, ρ is the nugget effect, σ^{2} is the variance, and r is the range.

- gencauchy

γ(d) = ρ+σ^{2} \cdot (1-(1+\frac{d^a}{r^a})^{- \frac{b}{a}})

where d is the distance, ρ is the nugget effect, σ^{2} is the variance, r is the range, a is the smoothness parameter, and b is the long-range parameter.

- matern

γ(d) = ρ+σ^{2} \cdot (1-\frac{2^{1-a}}{Γ(a)}\cdot \frac{d^a}{r^a} \cdot K_{a}(\frac{d}{r}))

where d is the distance, ρ is the nugget effect, σ^{2} is the variance, r is the range, and a is the smoothness parameter.

- Defaults-

By default, 99 weather random fields are simulated, and 4 of them are displayed.

If no vector of percentiles is provided, the 10th, 50th and 90th percentiles are determined and displayed.

## Value

The function returns both a graphical and a numerical output. The numerical output is a list with the following components:

 model Character string with the name of the variogram model used. nugget Value of the nugget effect. variance Value of the variance. range Value of the rang. additional.par Value(s) of the additional parameters required and used in the variogram model. This is returned only if the variogram model used is matern or gencauchy sim.fields 3-dimensional array where each layer contains the values of the simulated weather field at the gridded locations. pct.fields 3-dimensional array where each layer contains the specified percentile.

The graphical output consists in plots of the simulated weather fields displayed on multiple pages. Before displaying each page, the user will be asked for input.

## Note

This function depends on the following packages: RandomFields and fields.

## Author(s)

Berrocal, V. J. (veroberrocal@gmail.com), Raftery, A. E., Gneiting, T., Gel, Y.

## References

Gel, Y., Raftery, A. E., Gneiting, T. (2004). Calibrated probabilistic mesoscale weather field forecasting: The Geostatistical Output Perturbation (GOP) method (with discussion). Journal of the American Statistical Association, Vol. 99 (467), 575–583.

Gneiting, T., Schlather, M. (2004). Stochastic models that separate the fractal dimension and the Hurst effect. SIAM Review 46, 269–282.

Schlather, M. (2001). Simulation and Analysis of Random Fields. R News 1(2), 18–20.

Nychka, D. (2004). The fields package. Available at: http:lib.stat.cmu.edu/R/CRAN/doc/package/fields.pdf.

Stein, M. L. (1999). Interpolation of Spatial Data - Some Theory for Kriging. Springer-Verlag: New York.

plotfields, a plotting utility for weather random fields, GaussRF in the RandomFields package, for simulation of Gaussian random fields.
  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 ## 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.lon coord2.grid <- gridlat$gridded.lat forecast.grid <- forecast.grid$gridded.forecast ## Computing the empirical variogram variogram <- Emp.variog(day=day,obs=obs,forecast=forecast,id=id, coord1=coord1,coord2=coord2,cut.points=NULL,max.dist=NULL,nbins=NULL) ## Estimating parameters param.est <- Variog.fit(emp.variog=variogram,variog.model="exponential", max.dist.fit=NULL,init.val=NULL,fix.nugget=FALSE) ## Simulating realizations of the weather random field simul <- Field.sim(obs=obs,forecast=forecast,coord1.grid=coord1.grid, coord2.grid=coord2.grid,forecast.grid=forecast.grid,variog.model="exponential", param.est=c(param.est$nugget,param.est$variance,param.est$range),n.sim=4, n.displ=4,qt.displ=c(10,50,90))