if (FALSE) {
## If some of the next examples do not work, try using a different
## date. Check availability for each service with the links included in
## the references section.
testDay <- Sys.Date() - 1
## Retrieve raster data
wrf <- getRaster('temp', day = testDay)
## Display results with rasterVis
library(rasterVis)
levelplot(wrf, layers = 10:19)
hovmoller(wrf)
## Using box and frames specification
mfExtent('gfs')
cloudGFS <- getRaster('Temperature_surface',
day = testDay,
box = c(-30, 30, 30, 50),
service = 'gfs')
levelplot(cloudGFS, layout = c(1, 1))
mfExtent('nam')
cloudNAM <- getRaster('Temperature_surface',
day = testDay,
box = c(-100, -80, 30, 50),
frames = 10,
service = 'nam')
mfExtent('rap')
cloudRAP <- getRaster('Temperature_surface',
day = testDay,
box = c(-100, -80, 30, 50),
frames = 10,
service = 'rap')
## Day sequence of cloud cover
wrfDays <- getRasterDays('cft',
start = testDay - 3,
end = testDay + 2,
box = c(-2, 35, 2, 40))
levelplot(wrfDays, layers = 10:19)
## animation
levelplot(wrfDays, layout = c(1, 1), par.settings = BTCTheme)
## Hövmoller graphic
hovmoller(wrfDays, par.settings = BTCTheme, contour = TRUE, cuts = 10)
NAMDays <- getRasterDays('Temperature_surface',
start = testDay - 3,
end = testDay,
box = c(-100, -80, 30, 50),
service = 'nam')
## Extract data at some locations
st <- data.frame(name=c('Almeria','Granada','Huelva','Malaga','Caceres'),
elev=c(42, 702, 38, 29, 448))
coordinates(st) <- cbind(c(-2.46, -3.60, -6.94, -4.42, -6.37),
c(36.84, 37.18, 37.26, 36.63, 39.47)
)
proj4string(st) <- '+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0'
## Extract values for some locations
vals <- extract(wrf, st)
vals <- zoo(t(vals), getZ(wrf))
names(vals) <- st$name
xyplot(vals)
}
Run the code above in your browser using DataLab