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


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

--

Legend:

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

    v26 v27  
    99{{{
    1010> openDAP.query <- loadSeasonalForecast(dataset = "http://www.meteo.unican.es/tds5/dodsC/system4/System4_Seasonal_15Members.ncml",
    11 +                                         standard.vars = TRUE, dictionary = "System4_Seasonal_15Members.dic",
     11+                                         standard.vars = TRUE, dictionary = "datasets/forecasts/System4/System4_Seasonal_15Members.dic",
    1212+                                         var = "tas", members = 1,
    1313+                                         lonLim = c(-10,5), latLim = c(35,45),
    1414+                                         season = 1, years = 1990:1999, leadMonth = 1)
    15 >
    1615
    1716}}}
     
    9291[[Image(TmeanJan.png)]]
    9392
    94 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`):
     93Next, 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`):
    9594
    9695{{{
     
    106105> colnames(locations.data) <- city.names
    107106> str(locations.data)
    108  num [1:310, 1:4] 7.71 8.78 10.77 10.88 11.55 ...
     107 num [1:310, 1:2] 2.52 3.57 4.05 6.88 7.36 ...
    109108 - attr(*, "dimnames")=List of 2
    110109  ..$ : NULL
    111   ..$ : chr [1:4] "Sevilla" "Madrid" "Santander" "Zaragoza"
     110  ..$ : chr [1:2] "Madrid" "Santander"
    112111
    113112}}}
     
    126125> legend("bottomleft", city.names, lty=1, col=1:4)
    127126> title(main = "Mean surface Temperature January")
     127> mtext("System4 15 member Seasonal - 1st Member, lead month = 1")
    128128
    129129}}}