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

Ignore:
Timestamp:
May 24, 2013 5:36:38 PM (8 years ago)
Comment:

--

### Legend:

Unmodified
 v27 }}} [[Image(TmeanJan.png)]] [[Image(TmeanJanS4.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 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): [[Image(timeSeries.png)]] [[Image(timeSeriesS4.png)]] Alternatively, for selected point locations the function allows for the retrieval of single-point data. In this case, we can enter the lon and lat coordinates of the desired point in the lonLimand latLim arguments of the function. The function operates by finding the nearest grid point of the dataset to the given coordinates (in terms of Euclidean distances). For instance, the next two instructions load the data represented in the time series above directly for Santander and Madrid respectively: {{{ > santanderData <- loadSeasonalForecast(dataset = "http://www.meteo.unican.es/tds5/dodsC/system4/System4_Seasonal_15Members.ncml", +                                      standard.vars = TRUE, dictionary = "datasets/forecasts/System4/System4_Seasonal_15Members.dic", +                                      var = "tas", members = 1, +                                      lonLim = -3.81, latLim = 43.43, +                                      season = 1, years = 1990:1999, leadMonth = 1) >madridData <- loadSeasonalForecast(dataset = "http://www.meteo.unican.es/tds5/dodsC/system4/System4_Seasonal_15Members.ncml", +                                      standard.vars = TRUE, dictionary = "datasets/forecasts/System4/System4_Seasonal_15Members.dic", +                                      var = "tas", members = 1, +                                      lonLim = -3.68, latLim = 40.40, +                                      season = 1, years = 1990:1999, leadMonth = 1) > plot(santanderData$MemberData[[1]], ty='l', col = "red") > lines(madridData$MemberData[[1]], ty='l') > title("Same data as the previous plot") }}} [[Image(timeSeriesS4_2.png)]]