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

May 20, 2013 10:29:47 AM (8 years ago)



  • udg/ecoms/RPackage/examples

    v17 v18  
    246246= Creating a dataset =
     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.
     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:
     253> list.files("./datasets/reanalysis/Iberia_NCEP/")
     254[1] "" "" "" ""
     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:
     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
     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.
     271= datasetInventory =
     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.
     276> inv.iberiaNCEP <- dataInventory("Iberia_NCEP_dataset.ncml")