Changes between Version 14 and Version 15 of udg/ecoms/RPackage/examples/pointSelection


Ignore:
Timestamp:
May 15, 2015 12:16:17 PM (7 years ago)
Author:
juaco
Comment:

--

Legend:

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

    v14 v15  
    11= Single point selections
    22
    3 The following call to `loadECOMS` will load a time series of summer 2001 (JJA, `season = 6:8`, `years = 2001`) surface (2m) daily mean temperature (`var = "tas"`, as defined in the [http://meteo.unican.es/ecoms-udg/RPackage/Homogeneization vocabulary]) for the coordinate -3.7E 40.4N, (`lonLim = -3.7`, `latLim = 40.4`) corresponding to the city of Madrid (Spain), as forecasted the previous March (`leadMonth = 2`) by the CFSv2 hindcast (`dataset = "CFSv2_seasonal_16"`). We will select the first 10 members (`members = 1:10`). Note that the original variable is stored in the CFSv2 database as 6-hourly. Hence, we indicate to the function to compute the daily mean from the 6-hourly data using the argument `time = "DD".`
    4 
    5 
    6 First of all, the library is called and we log-in into the ECOMS-UDG:
     3First of all, the user needs to be [https://meteo.unican.es/trac/wiki/udg/registration registered] in the ECOMS-UDG via the Thredds administration Panel (TAP) before using the package for accessing any dataset. Once registered, the user will have a valid username and password and can log-in using the `loginECOMS_UDG` function:
    74
    85{{{
     
    129}}}
    1310
    14 Now we are ready for accessing the ECOMS-UDG:
     11Now we are ready for accessing the ECOMS-UDG.
     12
     13The following call to `loadECOMS` will load a time series of summer 2001 (JJA, `season = 6:8`, `years = 2001`) daily (`time = "DD"`) mean (`aggr.d = "mean"`) surface (2m) temperature (`var = "tas"`), for the coordinate -3.7E 40.4N, (`lonLim = -3.7`, `latLim = 40.4`) corresponding to the city of Madrid (Spain), as forecasted the previous March (`leadMonth = 2`) by the CFSv2 hindcast (`dataset = "CFSv2_seasonal"`). We will select the first 10 members (`members = 1:10`).
     14
    1515
    1616{{{
    1717#!text/R
    18 point.cfs <- loadECOMS(dataset = "CFSv2_seasonal_16",
     18point.cfs <- loadECOMS(dataset = "CFSv2_seasonal",
    1919                       var = "tas",
    2020                       members = 1:10,
     
    2424                       years = 2001,
    2525                       leadMonth = 2,
    26                        time = "DD")
     26                       time = "DD",
     27                       aggr.d = "mean")
    2728}}}
    2829
     
    3031
    3132{{{
    32 [2014-09-02 15:28:42] Defining homogeneization parameters for variable "tas"
    33 NOTE: daily mean will be calculated from the 6-h model output
    34 [2014-09-02 15:28:42] Defining geo-location parameters
    35 [2014-09-02 15:28:42] Defining initialization time parameters
    36 [2014-09-02 15:28:46] Retrieving data subset ...
    37 [2014-09-02 15:31:25] Done
     33[2015-05-15 11:46:49] Defining homogeneization parameters for variable "tas"
     34[2015-05-15 11:46:50] Defining geo-location parameters
     35[2015-05-15 11:46:50] Defining initialization time parameters
     36NOTE: Daily aggregation will be computed from 6-hourly data
     37[2015-05-15 11:46:54] Retrieving data subset ...
     38[2015-05-15 11:49:47] Done
    3839}}}
     40
     41The original variable is stored in the CFSv2 database as 6-hourly (see the [https://meteo.unican.es/trac/wiki/udg/ecoms/dataserver/listofvariables available variables] and their time resolution). Hence, we indicate to the function to perform a daily average using the argument `time = "DD"` via the `mean` function (`aggr.d = "mean"`).`
    3942
    4043This is the size of the loaded object:
    4144
    4245{{{#!text/R
    43 print(object.size(point.cfs)) # 22456 bytes
     46print(object.size(point.cfs)) # 20128 bytes
    4447}}}
    4548
    46 
    47 The returned object contains all the necessary information for data representation (geo-location, time ...). In the next lines we plot the loaded time series for each member. The element `Data` contains the data itself. In this case, it is a 2D array with the dimensions `member` (10 members selected) and `time` (92 days for June, July and August), as indicated by the `dimensions` attribute.
     49The returned object contains all the necessary information for data representation (geo-location, time, other metadata...). In the next lines we plot the loaded time series for each member. The element `Data` contains the data itself. In this case, it is a 2D array with the dimensions `member` (10 members selected) and `time` (92 days for June, July and August), as indicated by the `dimensions` attribute.
    4850
    4951
     
    5658
    5759{{{
    58  num [1:10, 1:92] 16.3 17.1 12.9 10.4 15.3 ...
     60 num [1:10, 1:92] 13.3 16.3 17.1 12.9 10.4 ...
    5961 - attr(*, "dimensions")= chr [1:2] "member" "time"
    6062}}}
    6163
    6264
    63 Note that, by convention, the dimensions of the Data array will be always ordered in the canonical form ''member > time > lat > lon''. Several vertical levels are never loaded at the same time, so the dimension ''level'' will never appear. This will be indicated in the Variables element of the returned output if existing. In this case it is NULL, because the variable loaded is a surface variable:
     65Note that, by convention, the dimensions of the Data array will be always ordered in the canonical form ''member > time > lat > lon''. Several vertical levels are never loaded at the same time, so the dimension ''level'' will never appear. This will be indicated in the Variables element of the returned output. In this case it is NULL, because the variable loaded is a surface variable. Other useful metadada are included in the Variables element:
    6466
    6567{{{
     
    7173
    7274{{{
    73 List of 3
    74  $ varName   : chr "tas"
    75  $ isStandard: logi TRUE
    76  $ level     : NULL
     75List of 2
     76 $ varName: chr "tas"
     77 $ level  : NULL
     78 - attr(*, "is_standard")= logi TRUE
     79 - attr(*, "units")= chr "degrees Celsius"
     80 - attr(*, "longname")= chr "2-meter air temperature"
     81 - attr(*, "daily_agg_cellfun")= chr "mean"
     82 - attr(*, "monthly_agg_cellfun")= chr "none"
     83 - attr(*, "verification_time")= chr "DD"
    7784}}}
    78 
    7985
    8086In the following example we plot the time series with the multi-member mean and its dispersion (interquartilic range 25-75):
     
    8692dates <- as.POSIXlt(point.cfs$Dates$start, tz="GMT")
    8793plot(dates, ens.mean, ylim = range(point.cfs$Data),
    88      type = 'n', ylab = "tas - Daily Mean", xlab = "time")
     94     type = 'n', ylab = point.cfs$Variable$varName, xlab = "time",
     95     main = attr(point.cfs$Variable, "longname"))
     96mtext(attr(point.cfs$Variable, "units"))
    8997polygon(x = c(dates, rev(dates)),
    9098        y = c(quartiles[1, ], rev(quartiles[2, ])),
     
    93101}}}
    94102
    95 [[Image(image-20140617-160406.png)]]
     103[[Image(image-20150515-121332.png)]]
    96104
    97105{{{#!comment
     
    145153lines(dates, point.wfdei$Data, col = "red", lwd = 1.5)
    146154}}}
    147 
    148 [[Image(image-20140617-161214.png)]]
     155[[Image(image-20150515-121332.png)]]
    149156
    150157We could include a legend in the figure to define the different elements shown: