Version 3 (modified by juaco, 8 years ago) (diff)


Alternative visualization tools: Monsoon in the Indian subcontinent

So far we have shown plotting examples using the trellis plots generated by the spplot method. In this examples we show alternative plotting options using more standard R plotting functions for gridded data. To this aim, we load the precipitation data of 1997 for the lead month 1 forecast over the Indian subcontinent, considering the monsoon season from June to September:

monsoon <- loadSeasonalForecast("CFS", var="tp", members=16, lonLim=c(65,92), latLim=c(5,37), season=6:9, years=1997)

The georeferencing of the data is stored as a SpatialGrid, which has several convenient attributes for an effective description of a gridded field, including the possibility of defining a coordinate reference system, highly useful -sometimes indispensable- for many geospatial operations. Plotting objects inheriting from this class or related classes (e.g. SpatialGridDataFrame) is straightforward using the spplot methods, as described in the previous example?, but it is not directly usable as input for other plotting methods in R. Next, we present some typical plotting functions and how to extract the spatial coordinates in a suitable format for plotting.

The total precipitation field is calculated as the total accumulated precipitation during the selected period for each model grid cell:

tp <- colSums(monsoon$MemberData$Member_16) 

And this is the classical way of displaying the data using the spplot method:

sgdf <- SpatialGridDataFrame(monsoon$LonLatCoords,
wl <- as(world_map, "SpatialLines")
wlines <- list("sp.lines", wl)
spplot(sgdf, scales = list(draw = TRUE), sp.layout = list(wlines), col.regions = rev(topo.colors(41)))

No image "spplot.png" attached to udg/ecoms/RPackage/examples/continentalSelection

It is also straightforward to represent the precipitation using contour lines:

spplot(sgdf, scales = list(draw = TRUE), contour = TRUE, col = "red", col.regions = rev(topo.colors(41)))

No image "spplot_contour.png" attached to udg/ecoms/RPackage/examples/continentalSelection

Attachments (1)

Download all attachments as: .zip