# Changes between Version 26 and Version 27 of udg/ecoms/RPackage/examples

Ignore:
Timestamp:
May 24, 2013 5:20:00 PM (9 years ago)
Comment:

--

### Legend:

Unmodified
 v26 {{{ > openDAP.query <- loadSeasonalForecast(dataset = "http://www.meteo.unican.es/tds5/dodsC/system4/System4_Seasonal_15Members.ncml", +                                         standard.vars = TRUE, dictionary = "System4_Seasonal_15Members.dic", +                                         standard.vars = TRUE, dictionary = "datasets/forecasts/System4/System4_Seasonal_15Members.dic", +                                         var = "tas", members = 1, +                                         lonLim = c(-10,5), latLim = c(35,45), +                                         season = 1, years = 1990:1999, leadMonth = 1) > }}} [[Image(TmeanJan.png)]] Next, we plot the time series for the selected locations. To this aim, we calculate the nearest grid points to the specified locations. This can be easily done using the function fields::rdist. Note that the output of loadSystem4 returns a matrix of Lat-Lon coordinates, as usually found in many climate datasets.  However, the usual format of 2D coordinates matrix in R is Lon-Lat. As a result, note that we specify the coordinates by reversing the column order (i.e.: openDAP.query$LatLonCoords[ ,2:1] instead of openDAP.query$LatLonCoords): Next, we plot the time series for the selected locations. To this aim, we calculate the nearest grid points to the specified locations. This can be easily done using the function fields::rdist. Note that the output of loadSeasonalForecast returns a matrix of Lat-Lon coordinates, as usually found in many climate datasets.  However, the usual format of 2D coordinates matrix in R is Lon-Lat. As a result, note that we specify the coordinates by reversing the column order (i.e.: openDAP.query$LatLonCoords[ ,2:1] instead of openDAP.query$LatLonCoords): {{{ > colnames(locations.data) <- city.names > str(locations.data) num [1:310, 1:4] 7.71 8.78 10.77 10.88 11.55 ... num [1:310, 1:2] 2.52 3.57 4.05 6.88 7.36 ... - attr(*, "dimnames")=List of 2 ..$: NULL ..$ : chr [1:4] "Sevilla" "Madrid" "Santander" "Zaragoza" ..\$ : chr [1:2] "Madrid" "Santander" }}} > legend("bottomleft", city.names, lty=1, col=1:4) > title(main = "Mean surface Temperature January") > mtext("System4 15 member Seasonal - 1st Member, lead month = 1") }}}