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

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

--

### Legend:

Unmodified
 v17 = Creating a dataset = Climate 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. In 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: {{{ > list.files("./datasets/reanalysis/Iberia_NCEP/") [1] "NCEP_Q850.nc" "NCEP_SLPd.nc" "NCEP_T850.nc" "NCEP_Z500.nc" }}} The 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: {{{ > makeNcmlDataset(source.dir="datasets/reanalysis/Iberia_NCEP/", ncml.file="Iberia_NCEP_dataset.ncml") [2013-05-20 10:00:51] NcML file "Iberia_NCEP_dataset.ncml" created from 4 files corresponding to 4 variables Use 'dataInventory(NcML file)' to obtain a description of the dataset }}} The 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. = datasetInventory = With the aid of the datasetInventoryfunction 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. {{{ > inv.iberiaNCEP <- dataInventory("Iberia_NCEP_dataset.ncml") }}}