Changes between Version 46 and Version 47 of udg/ecoms/RPackage/examples


Ignore:
Timestamp:
Feb 20, 2014 10:23:31 AM (8 years ago)
Author:
juaco
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • udg/ecoms/RPackage/examples

    v46 v47  
    1 = EXAMPLE 1: Loading and plotting various members
     1In this section a number of examples for data download and visualization/analysis are presented within the R environment. Note that this section is still under construction and permanent update. Further examples will be added soon.
    22
    3 Total precipitation at the Gulf of Guinea for January 2010 forecasted in October 2009 (lead month 3) by the System4 model (seasonal range, 15 members) is next represented for each member, using the `spplot` method for the `SpatialGridDataFrame` class of library `sp`:
    4 
    5 Data are loaded by introducing the required values for dataset, spatio-temporal window and lead month definition. Note that the argument `members` is omitted, which means that by default all available members (15 in this case, will be returned).
    6 
    7 {{{
    8 gg.pr <- loadSeasonalForecast("System4_seasonal_15", var="tp", lonLim=c(-30,20), latLim=c(-12,15), season=1, years=2010, leadMonth=3)
    9 }}}
    10 
    11 Next, total accumulated precipitation is computed for each grid point, and a `SpatialGridDataFrame` is created:
    12 
    13 {{{
    14 df <- sapply(gg.pr$MemberData, colSums)
    15 sgdf <- SpatialGridDataFrame(gg.pr$LonLatCoords, as.data.frame(df))
    16 spplot(sgdf, scales=list(draw=TRUE), col.regions=rev(terrain.colors(50)), at=seq(0,ceiling(max(sgdf@data)),10))
    17 }}}
    18 
    19 [[Image(GulfOfGuinea15members.png)]]
    20 
    21 It is often useful to have a world map as a backdrop for visual reference. The dataset `world_map` is built-in in the `ecomsUDG.Raccess` package:
    22 
    23 {{{
    24 data(world_map)
    25 wl <- as(world_map, "SpatialLines")
    26 l1 <- list("sp.lines", wl)
    27 }}}
    28 
    29 For the visualization of a subset of members we use the `zcol` argument. For instance, members 4, 9, 13 and 14 yield a high precipitation forecast in the southern region:
    30 
    31 {{{
    32 spplot(sgdf, zcol=c(4,9,13,14), scales=list(draw=TRUE), col.regions=rev(terrain.colors(50)), at=seq(0, ceiling(max(sgdf@data)),10), sp.layout=list(l1))
    33 }}}
    34 
    35 [[Image(GulfOfGuineaSubsetMember.png)]]
     3* [wiki:./Trellis EXAMPLE 1: Trellis maps for data visualization]
     4* [wiki:./Drift EXAMPLE 2: Analysing model drift]