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


Ignore:
Timestamp:
May 20, 2013 10:45:17 AM (8 years ago)
Author:
juaco
Comment:

--

Legend:

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

    v18 v19  
    77> rfuncs <- list.files(pattern = "\\.R$")
    88> print(rfuncs)
    9 [1] "dataInventory.R"    "loadData.R"         "loadObservations.R" "loadSystem4.R"      "makeNcmlDataset.R"  "makeVocabulary.R" 
     9[1] "dataInventory.R"    "loadData.R"         "loadObservations.R" "loadSystem4.R"      "makeNcmlDataset.R"
    1010> for (i in 1:length(rfuncs)) {
    1111+      source(rfuncs[i])
     
    269269The function creates a new NcML file in the directory specified (in this case in the working directory, as no path has been specified), and gives some information about the number of files and variables conforming the dataset. In the next section is described how to find out the different variables stored in the newly created dataset and their characteristics.
    270270
    271 = datasetInventory =
    272 
    273 With the aid of the `datasetInventory`function we can easily retrieve all the necessary information to access and manipulate the variables sotred in a dataset.  In the following example, we get a description of the NcML dataset created in the previous section, containing several variables of the NCEP reanalysis in the Iberian Peninsula.
     271= dataInventory =
     272
     273With the aid of the `dataInventory`function we can easily retrieve all the necessary information to access and manipulate the variables stored in a dataset.  In the following example, we get a description of the NcML dataset created in the previous section, containing several variables of the NCEP reanalysis in the Iberian Peninsula.
    274274
    275275{{{
    276276> inv.iberiaNCEP <- dataInventory("Iberia_NCEP_dataset.ncml")
    277 
    278 }}}
    279 
    280 
    281 
    282 
    283 
    284 
     277# Structure of the inventory
     278> str(inv.iberiaNCEP)
     279List of 4
     280 $ Q   :List of 5
     281  ..$ Description: chr "Specific humidity"
     282  ..$ DataType   : chr "float"
     283  ..$ Units      : chr "kg kg**-1"
     284  ..$ TimeStep   :Class 'difftime'  atomic [1:1] 24
     285  .. .. ..- attr(*, "tzone")= chr ""
     286  .. .. ..- attr(*, "units")= chr "hours"
     287  ..$ Dimensions :List of 4
     288  .. ..$ level:List of 3
     289  .. .. ..$ Type  : chr "Pressure"
     290  .. .. ..$ Units : chr "millibar"
     291  .. .. ..$ Values: num 850
     292  .. ..$ time :List of 3
     293  .. .. ..$ Type  : chr "Time"
     294  .. .. ..$ Units : chr "days since 1950-01-01 00:00:00"
     295  .. .. ..$ Values: POSIXlt[1:16071], format: "1958-01-01" "1958-01-02" "1958-01-03" "1958-01-04" ...
     296  .. ..$ lat  :List of 3
     297  .. .. ..$ Type  : chr "Lat"
     298  .. .. ..$ Units : chr "degrees north"
     299  .. .. ..$ Values: num [1:6] 35 37.5 40 42.5 45 47.5
     300  .. ..$ lon  :List of 3
     301  .. .. ..$ Type  : chr "Lon"
     302  .. .. ..$ Units : chr "degrees east"
     303  .. .. ..$ Values: num [1:9] -15 -12.5 -10 -7.5 -5 -2.5 0 2.5 5
     304 $ SLPd:List of 5
     305  ..$ Description: chr "Mean Sea Level Pressure; Mean daily value"
     306  ..$ DataType   : chr "float"
     307  ..$ Units      : chr "Pa"
     308  ..$ TimeStep   :Class 'difftime'  atomic [1:1] 24
     309  .. .. ..- attr(*, "tzone")= chr ""
     310  .. .. ..- attr(*, "units")= chr "hours"
     311  ..$ Dimensions :List of 3
     312  .. ..$ time:List of 3
     313  .. .. ..$ Type  : chr "Time"
     314  .. .. ..$ Units : chr "days since 1950-01-01 00:00:00"
     315  .. .. ..$ Values: POSIXlt[1:16071], format: "1958-01-01" "1958-01-02" "1958-01-03" "1958-01-04" ...
     316  .. ..$ lat :List of 3
     317  .. .. ..$ Type  : chr "Lat"
     318  .. .. ..$ Units : chr "degrees north"
     319  .. .. ..$ Values: num [1:6] 35 37.5 40 42.5 45 47.5
     320  .. ..$ lon :List of 3
     321  .. .. ..$ Type  : chr "Lon"
     322  .. .. ..$ Units : chr "degrees east"
     323  .. .. ..$ Values: num [1:9] -15 -12.5 -10 -7.5 -5 -2.5 0 2.5 5
     324 $ T   :List of 5
     325  ..$ Description: chr "Temperature"
     326  ..$ DataType   : chr "float"
     327  ..$ Units      : chr "K"
     328  ..$ TimeStep   :Class 'difftime'  atomic [1:1] 24
     329  .. .. ..- attr(*, "tzone")= chr ""
     330  .. .. ..- attr(*, "units")= chr "hours"
     331  ..$ Dimensions :List of 4
     332  .. ..$ level:List of 3
     333  .. .. ..$ Type  : chr "Pressure"
     334  .. .. ..$ Units : chr "millibar"
     335  .. .. ..$ Values: num 850
     336  .. ..$ time :List of 3
     337  .. .. ..$ Type  : chr "Time"
     338  .. .. ..$ Units : chr "days since 1950-01-01 00:00:00"
     339  .. .. ..$ Values: POSIXlt[1:16071], format: "1958-01-01" "1958-01-02" "1958-01-03" "1958-01-04" ...
     340  .. ..$ lat  :List of 3
     341  .. .. ..$ Type  : chr "Lat"
     342  .. .. ..$ Units : chr "degrees north"
     343  .. .. ..$ Values: num [1:6] 35 37.5 40 42.5 45 47.5
     344  .. ..$ lon  :List of 3
     345  .. .. ..$ Type  : chr "Lon"
     346  .. .. ..$ Units : chr "degrees east"
     347  .. .. ..$ Values: num [1:9] -15 -12.5 -10 -7.5 -5 -2.5 0 2.5 5
     348 $ Z   :List of 5
     349  ..$ Description: chr "Geopotential"
     350  ..$ DataType   : chr "float"
     351  ..$ Units      : chr "m**2 s**-2"
     352  ..$ TimeStep   :Class 'difftime'  atomic [1:1] 24
     353  .. .. ..- attr(*, "tzone")= chr ""
     354  .. .. ..- attr(*, "units")= chr "hours"
     355  ..$ Dimensions :List of 4
     356  .. ..$ level:List of 3
     357  .. .. ..$ Type  : chr "Pressure"
     358  .. .. ..$ Units : chr "millibar"
     359  .. .. ..$ Values: num 850
     360  .. ..$ time :List of 3
     361  .. .. ..$ Type  : chr "Time"
     362  .. .. ..$ Units : chr "days since 1950-01-01 00:00:00"
     363  .. .. ..$ Values: POSIXlt[1:16071], format: "1958-01-01" "1958-01-02" "1958-01-03" "1958-01-04" ...
     364  .. ..$ lat  :List of 3
     365  .. .. ..$ Type  : chr "Lat"
     366  .. .. ..$ Units : chr "degrees north"
     367  .. .. ..$ Values: num [1:6] 35 37.5 40 42.5 45 47.5
     368  .. ..$ lon  :List of 3
     369  .. .. ..$ Type  : chr "Lon"
     370  .. .. ..$ Units : chr "degrees east"
     371  .. .. ..$ Values: num [1:9] -15 -12.5 -10 -7.5 -5 -2.5 0 2.5 5
     372
     373}}}
     374
     375
     376As we can see, the inventory consists of a list of four elements, which are the four variables stored in the dataset:
     377
     378{{{
     379> names(inv.iberiaNCEP)
     380[1] "Q"    "SLPd" "T"    "Z" 
     381
     382}}}
     383
     384
     385= loadData =
     386
     387
     388