Changes between Version 19 and Version 20 of udg/ecoms/RPackage/examples


Ignore:
Timestamp:
May 20, 2013 11:34:21 AM (8 years ago)
Author:
juaco
Comment:

--

Legend:

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

    v19 v20  
    383383
    384384
     385This is how we can check the spatial domain of the dataset:
     386
     387{{{
     388> lats = inv.iberiaNCEP$SLPd$Dimensions$lat$Values
     389> lons = inv.iberiaNCEP$SLPd$Dimensions$lon$Values
     390> plot(expand.grid(lons,lats), asp=1)
     391# 'world' from library 'fields'
     392> world(add=TRUE)
     393
     394}}}
     395
     396[[Image(iberiaNCEPextent.png)]]
     397
    385398= loadData =
    386399
    387 
    388 
     400Once the NcML dataset is created and we get an idea of the nature of the variables stored, the `loadData` function is used to retrieve the variables desired at selected dimensional slices. In this particular example, we will load the temperature data from the NCEP reanalysis in the Iberian Peninsula.
     401
     402We have a look again to the description of the variable temperature, as provided by the `dataInventory`:
     403
     404{{{
     405> str(inv.iberiaNCEP$T)
     406List of 5
     407 $ Description: chr "Temperature"
     408 $ DataType   : chr "float"
     409 $ Units      : chr "K"
     410 $ TimeStep   :Class 'difftime'  atomic [1:1] 24
     411  .. ..- attr(*, "tzone")= chr ""
     412  .. ..- attr(*, "units")= chr "hours"
     413 $ Dimensions :List of 4
     414  ..$ level:List of 3
     415  .. ..$ Type  : chr "Pressure"
     416  .. ..$ Units : chr "millibar"
     417  .. ..$ Values: num 850
     418  ..$ time :List of 3
     419  .. ..$ Type  : chr "Time"
     420  .. ..$ Units : chr "days since 1950-01-01 00:00:00"
     421  .. ..$ Values: POSIXlt[1:16071], format: "1958-01-01" "1958-01-02" "1958-01-03" "1958-01-04" ...
     422  ..$ lat  :List of 3
     423  .. ..$ Type  : chr "Lat"
     424  .. ..$ Units : chr "degrees north"
     425  .. ..$ Values: num [1:6] 35 37.5 40 42.5 45 47.5
     426  ..$ lon  :List of 3
     427  .. ..$ Type  : chr "Lon"
     428  .. ..$ Units : chr "degrees east"
     429  .. ..$ Values: num [1:9] -15 -12.5 -10 -7.5 -5 -2.5 0 2.5 5
     430
     431}}}
     432
     433As we can see, the variable T has vertical levels. In this case, the only level available is at 850 mb. The variable is daily, as we can see in the `TimeStep` element of the list, and the original units are Kelvin.
     434
     435There are several options for spatial selection using the 'loadData` function. For instance, if we want the whole domain of teh dataset ()
     436
     437
     438
     439= Using standard variables via vocabulary and dictionary =
     440
     441
     442