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


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

--

Legend:

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

    v17 v18  
    246246= Creating a dataset =
    247247
     248Climate datasets of various types (e.g. reanalysis, RCM/GCM data...) are often stored as collections of netCDF files for each particular variable and/or time slice. These files can be either locally or remotely stored. A convenient way of dealing with this kind of datasets is the use of NcML files. A NcML file is a ​XML representation of netCDF metadata. By means of NcML it is possible to create virtual datasets by modifying and aggregating other datasets, thus providing maximum flexibility and ease of access to data stored in collections of files containing data from different variables/time slices. The function `makeNcmlDataset` is intended to deal with reanalysis, forecasts and other climate data products, often consisting of collections of netCDF files of these characteristics.
     249
     250In this example, we have chosen several variables commonly used in statistical downscaling applications belonging to the NCEP reanalysis, and stored in different netCDF files. These variables are stored in the following directory:
     251
     252{{{
     253> list.files("./datasets/reanalysis/Iberia_NCEP/")
     254[1] "NCEP_Q850.nc" "NCEP_SLPd.nc" "NCEP_T850.nc" "NCEP_Z500.nc"
     255
     256}}}
     257
     258
     259The function `makeNcmlDataset` is used to conveniently aggregate the required information so that the inventory/loading functions point to the NcML rather that to the netCDF files. The following call to the function wll create the NcML file in the current working directory:
     260
     261{{{
     262> makeNcmlDataset(source.dir="datasets/reanalysis/Iberia_NCEP/", ncml.file="Iberia_NCEP_dataset.ncml")
     263[2013-05-20 10:00:51]
     264NcML file "Iberia_NCEP_dataset.ncml" created from 4 files corresponding to 4 variables
     265Use 'dataInventory(NcML file)' to obtain a description of the dataset
     266
     267}}}
     268
     269The 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.
     270
     271= datasetInventory =
     272
     273With 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.
     274
     275{{{
     276> inv.iberiaNCEP <- dataInventory("Iberia_NCEP_dataset.ncml")
     277
     278}}}
     279
     280
     281
     282
     283
     284