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


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

--

Legend:

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

    v27 v28  
    8989}}}
    9090
    91 [[Image(TmeanJan.png)]]
     91[[Image(TmeanJanS4.png)]]
    9292
    9393Next, 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`):
     
    130130
    131131
    132 [[Image(timeSeries.png)]]
     132[[Image(timeSeriesS4.png)]]
     133
     134
     135Alternatively, 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 `lonLim`and `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:
     136
     137{{{
     138> santanderData <- loadSeasonalForecast(dataset = "http://www.meteo.unican.es/tds5/dodsC/system4/System4_Seasonal_15Members.ncml",
     139+                                      standard.vars = TRUE, dictionary = "datasets/forecasts/System4/System4_Seasonal_15Members.dic",
     140+                                      var = "tas", members = 1,
     141+                                      lonLim = -3.81, latLim = 43.43,
     142+                                      season = 1, years = 1990:1999, leadMonth = 1)
     143>madridData <- loadSeasonalForecast(dataset = "http://www.meteo.unican.es/tds5/dodsC/system4/System4_Seasonal_15Members.ncml",
     144+                                      standard.vars = TRUE, dictionary = "datasets/forecasts/System4/System4_Seasonal_15Members.dic",
     145+                                      var = "tas", members = 1,
     146+                                      lonLim = -3.68, latLim = 40.40,
     147+                                      season = 1, years = 1990:1999, leadMonth = 1)
     148> plot(santanderData$MemberData[[1]], ty='l', col = "red")
     149> lines(madridData$MemberData[[1]], ty='l')
     150> title("Same data as the previous plot")
     151
     152}}}
     153
     154
     155[[Image(timeSeriesS4_2.png)]]
     156
     157
     158
     159
    133160
    134161