Changes between Version 1 and Version 2 of udg/ecoms/RPackage/examples/visualization


Ignore:
Timestamp:
May 13, 2016 4:12:25 PM (6 years ago)
Author:
juaco
Comment:

--

Legend:

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

    v1 v2  
    77== Package loading/install
    88
    9 We first load (and install if necessary) the required libraries. `loadeR.ECOMS` and `visualizeR`, used for data loading and visualization respectively (see the installation instructions for [http://meteo.unican.es/trac/wiki/udg/ecoms/RPackage/versions loadeR.ECOMS] and [https://github.com/SantanderMetGroup/visualizeR visualizeR] packages.
     9We first load (and install if necessary) the required libraries. `loadeR.ECOMS` and `visualizeR`, used for data loading and visualization respectively (see the installation instructions for [http://meteo.unican.es/trac/wiki/udg/ecoms/RPackage/versions loadeR.ECOMS] and [https://github.com/SantanderMetGroup/visualizeR visualizeR] packages. In addition, `downscaleR` will be used for data manipulation (regridding).
    1010
    1111{{{#!text/R
    1212library(loadeR.ECOMS)
    1313library(visualizeR)
     14library(downscaleR
    1415}}}
    1516
    1617
    1718== Data loading from the ECOMS-UDG
     19
     20We load the predictions:
    1821
    1922{{{#!text/R
     
    3437## [2016-05-12 12:56:51] Retrieving data subset ...
    3538## [2016-05-12 13:07:02] Done
     39
     40plotMeanGrid(tx.forecast, multi.member = TRUE)
    3641}}}
     42
     43[[Image(image-20160513-160329.png)]]
     44
     45
     46And then we load the verifying observations (WFDEI dataset):
    3747
    3848
     
    5161## [2016-05-12 14:03:42] Retrieving data subset ...
    5262## [2016-05-12 14:03:52] Done
     63
     64plotMeanGrid(tx.obs)
     65
    5366}}}
     67
     68[[Image(image-20160513-160454.png)]]
     69
     70In order to compare the predictions against the observations, these need to be in the same reference grid. We use the interpolation capabilities of `downscaleR` to this aim:
     71
     72{{{#!text/R
     73obsintp <- interpGrid(tx.obs,
     74                  new.coordinates = getGrid(tx.forecast),
     75                  method = "nearest")
     76## [2016-05-13 16:06:45] Calculating nearest neighbors...
     77## [2016-05-13 16:06:45] Performing nearest interpolation... may take a while
     78## [2016-05-13 16:06:45] Done
     79## Warning message:
     80## In interpGrid(tx.obs, new.coordinates = getGrid(tx.forecast), method = "nearest") :
     81##   The new longitudes are outside the data extent
     82}}}
     83
     84`visualizeR` uses its own particular classes for handling data. It is necessary to convert to the `visualizeR` classes before using the visualization functions:
     85
     86{{{#!text/R
     87prd <- as.MrEnsemble(tx.forecast)
     88class(prd)
     89## [1] "MrEnsemble"
     90## attr(,"package")
     91## [1] "visualizeR"
     92obs <- as.MrGrid(obsintp)
     93class(obs)
     94## [1] "MrGrid"
     95## attr(,"package")
     96## [1] "visualizeR"
     97}}}
     98
     99
     100