meteoForecast
is a package to access outputs from Numerical Weather Prediction models both in raster format and as a time series for a location.
The current version works with these services:
New services will be added gradually, using this collection of meteorological data sources as reference.
This package has been developed in the framework of the European Project PVCROPS.
The development version is available at GitHub:
## install.packages("devtools")
devtools::install_github("meteoForecast", "oscarperpinan")
The stable version is available at CRAN:
install.packages('meteoForecast')
library(meteoForecast)
Load varsMG
, varsOM
and varsGFS
to know about the variables available in
each service:
data(varsMG)
head(varsMG)
data(varsOM)
head(varsOM)
data(varsGFS)
head(varsGFS)
getRaster
gets a forecast output inside a bounding box and provides a multilayer raster data using theRasterBrick
class defined in the packageraster
.wrf <- getRaster('temp', '2014-01-25', '00', remote=TRUE)
library(rasterVis) levelplot(wrf, layers = 10:21)
getRasterDays
usesgetRaster
to download the results cast each day comprised betweenstart
andend
using the 00UTC run.wrfDays <- getRasterDays('cft', start = '2014-01-01', end = '2014-01-05', box = c(-2, 35, 2, 40)) hovmoller(wrfDays, par.settings = BTCTheme, interpolate = TRUE, panel = panel.levelplot.raster)
getPoint
, getPointDays
, and getPointRuns
get data for a
certain location and produce a time series using the zoo
class.
getPoint
## temperature (Kelvin) forecast from meteogalicia tempK <- getPoint(c(0, 40), vars = 'temp') ## Cell does not coincide exactly with request attr(tempK, 'lat') attr(tempK, 'lon') ## Units conversion tempC <- tempK - 273
xyplot(tempC)
getPointDays
## Time sequence radDays <- getPointDays(c(0, 40), start = '2013-01-01', end = '2013-01-15') xyplot(radDays)
getPointRuns
## Variability between runs radRuns <- getPointRuns(c(0, 40), start = '2013-01-01', end = '2013-01-15') xyplot(radRuns, superpose = TRUE)
## variability around the average
radAv <- rowMeans(radRuns)
radVar <- sweep(radRuns, 1, radAv)
xyplot(radVar, superpose = TRUE)