plotfields          package:ProbForecastGOP          R Documentation

_P_l_o_t _o_f _w_e_a_t_h_e_r _f_i_e_l_d_s

_D_e_s_c_r_i_p_t_i_o_n:

     Plot weather fields.

_U_s_a_g_e:

     plotfields(field, x.lim, y.lim, country.outline="US", title)

_A_r_g_u_m_e_n_t_s:

   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.

country.outline: character string indicating which country to  outline
          in the plot. Possible values are "US", "world" or "both". If
          "US"  is specified, a medium resolution outline of the US
          with the states and  bodies of water is added to plot. If
          "world" is specified, a medium  resolution of bodies of land
          and mass of water delimited by the smallest  and largest
          latitude and longitude specified in 'x.lim' and  'y.lim' is
          added to the plot. If 'country.outline' is set equal  to
          'both', medium resolution of both the US and of the bodies of
          land  and water enclosed between the specified latitude and
          longitude are added to  the plot. Default value is "US".

   title: character string with the title for the plot.

_V_a_l_u_e:

     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.

_N_o_t_e:

     This function uses the package 'fields'.

_A_u_t_h_o_r(_s):

     Gel, Y., Raftery, A. E., Gneiting, T., Berrocal, V. J.
     veronica@stat.washington.edu.

_R_e_f_e_r_e_n_c_e_s:

     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.

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

_S_e_e _A_l_s_o:

     The package 'fields' for display of spatial data, and 'US' and
     'world' for a map of the US and the world.

_E_x_a_m_p_l_e_s:

     ## 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),mai=c(0.8,0.8,0.8,0.8))
     plotfields(simul$sim.fields[,,1],x.lim=c(min(coord1.grid),max(coord1.grid)),
     y.lim=c(min(coord2.grid),max(coord2.grid)),country.outline="US",title="Simulated weather field")

     ## Plotting one of the percentiles of the weather field
     par(mfrow=c(1,1),mai=c(0.8,0.8,0.8,0.8))
     plotfields(simul$pct.fields[,,1],x.lim=c(min(coord1.grid),max(coord1.grid)),
     y.lim=c(min(coord2.grid),max(coord2.grid)),country.outline="US",title="10th percentile")

