wiki:udg/ecoms/RPackage/examples

Version 7 (modified by juaco, 9 years ago) (diff)

--

In the next lines we describe an illustrative example of the loadSystem4 function. We will retrieve System4 simulation data for the Iberian Peninsula, considering mean surface temperature for January and the first simulation member, for the three-year period 1981-1983. This simple example has been chosen because of the fast data access (note that this also depends on the connection speed). Using a standard broadband connection, running this example took approximately 6 seconds.

openDAP.query <- loadSystem4(dataset = "http://www.meteo.unican.es/tds5/dodsC/system4/System4_Seasonal_15Members.ncml", 
                             var = "tas", members = 1,
                             lonLim = c(-10,5), latLim = c(35,45),
                             season = 1, years = 1981:1983, leadMonth = 1)
mean.field <- colMeans(openDAP.query$MemberData[[1]])
lat <- openDAP.query$Coordinates[ ,1]
lon <- openDAP.query$Coordinates[ ,2]
# Requires package "akima"
library(akima)
filled.contour(interp(lon, lat, mean.field), asp=1,
               plot.title = title (main = "Mean surface T January 1981-83",ylab = "latitude", xlab = "longitude"),
               key.title = title(main = "degK"),
               key.axes = axis(4, seq(273,289,1)))