Changes between Version 4 and Version 5 of ADAGUC
- Timestamp:
- Aug 22, 2008, 4:43:18 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ADAGUC
v4 v5 1 1 = ADAGUC netCDF - * CURRENTLY UNDER CONSTRUCTION * = 2 The ADAGUC netCDF driver reads and writes files which comply with the ADAGUC Data Products Standard [http://adaguc.knmi.nl (ADAGUC website)]. ADAGUC files are created by using the NetCDF4 API. The NetCDF4 API has the ability to store files in the HDF5 file format while remaining backwards compatible with previous versions of netCDF. The ADAGUC driver supports the creation of NetCDF3 and NetCDF4 files. In NetCDF3 mode the driver writes NetCDF files, in NetCDF4 mode the driver writes HDF5 files. ADAGUC netCDF files follow the Climate and Forecast (CF) 1.2 and ISO:19115 metadata conventions. Besides these conventions the format provides space for specific product metadata. 2 3 The ADAGUC netCDF driver reads and writes files which comply with the ADAGUC Data Products Standard [http://adaguc.knmi.nl ADAGUC website] (Atmospheric Data Access for the Geospatial User Community). ADAGUC files are created by using the NetCDF4 API. The NetCDF4 API has the ability to store files in the HDF5 file format while remaining backwards compatible with previous versions of netCDF. The ADAGUC driver supports the creation of NetCDF3 and NetCDF4 files. In NetCDF3 mode the driver writes NetCDF files, in NetCDF4 mode the driver writes HDF5 files. ADAGUC netCDF files follow the Climate and Forecast (CF) 1.2 and ISO:19115 metadata conventions. Besides these conventions the format provides space for specific product metadata. 3 4 == The file structure == 4 The ADAGUC internal file structure contains variables which can be subdivided in three types: variables to store the metadata, variables to store the dimension scales and variables to store the data. A schematic overview of the ADAGUC file structure for the different types is given in the figure of the file structure ( below). The three types of variables (metadata, dimension scales and data) are indicated with A, B and C respectively.5 The ADAGUC internal file structure contains variables which can be subdivided in three types: variables to store the metadata, variables to store the dimension scales and variables to store the data. A schematic overview of the ADAGUC file structure for the different types is given in the figure of the file structure (figure below on the left). The three types of variables (metadata, dimension scales and data) are indicated with A, B and C respectively. 5 6 6 7 … … 13 14 14 15 The ADAGUC format currently supports X, Y and time dimensions, stored as dimension scales in the file according the CF Conventions. The driver supports two ways of time sub-setting. The first is by making selections in time by choosing band numbers, the second is by providing the time in the file name. By using gdalinfo on the ADAGUC file the available band numbers and dimensions are listed. With this information a subset can be read with for example: 16 {{{ 15 17 gdalinfo ADAGUC:thefile.nc:variable:time=20 18 }}} 16 19 [[Image(ADAGUC_raster_file_structure_small.jpg, 250)]] [[Image(ADAGUC_NetCDF_dimension_scales.jpg, 310)]] 17 20 Left: filestructure; Right: dimension scales … … 22 25 '''METANCML''' – It is possible to provide additional metadata which is stored in an NcML XML file. The attributes from the groups product, iso_dataset, projection and custom are copied. When the name of the dataset is specified in the product::variables attribute, specific dataset attributes can be placed under the group with the name of the dataset. For example: -co “METANCML=NcMLMetadataFile.xml” 23 26 24 '''FORCENC3''' – When set to true, the NetCDF4 driver writes in NetCDF3 mode. When unspecified the value is FALSE, in this case the driver writes in NetCDF4 mode. For example: -co “FORCENC3=TRUE”27 '''FORCENC3''' – When set to true, the NetCDF4 driver writes in NetCDF3 mode. When unspecified the value is FALSE, in this case the driver writes in NetCDF4 mode. For example: {{{-co “FORCENC3=TRUE” 25 28 26 29 '''VALSTART''' and '''VALSTOP''' – Overwrites the product validity_start and product validity_stop attributes in the product group. … … 34 37 ---- 35 38 == Building the driver == 39 '''Download the required libraries'''[[BR]] 36 40 The ADAGUC netCDF driver requires at least the netCDF-4.0, HDF-1.8.1 and UDUNITS-1 packages to be installed. 37 * [http://www.unidata.ucar.edu/packages/netcdf/ netCDF library]38 41 * [http://www.hdfgroup.org/HDF5/ HDF5 library] 39 * [http://www.unidata.ucar.edu/software/udunits/udunits-1/index.html] Unidata units library] 42 * [http://www.unidata.ucar.edu/packages/netcdf/ netCDF4 library] 43 * [http://www.unidata.ucar.edu/software/udunits/udunits-1/index.html Unidata units library] 40 44 45 '''Configuring the libraries''' 46 * HDF5 library: 47 [[BR]] ./configure --prefix=<installdir> --with-default-api-version=v16 48 * netCDF4 library: 49 [[BR]] ./configure --prefix=<installdir> --with-hdf5=<installdir> --enable-netcdf-4 --enable-cxx-4 --enable-shared 50 * UDUNITS library:[[BR]]Un SUSE I had to export several environment variables to make it work: 51 [[BR]] export FC=g77 52 [[BR]] export CPPFLAGS=-Df2cFortran 53 [[BR]] export CC=gcc 54 [[BR]] export CXX=g++ 55 [[BR]] export LD_MATH=-lm 56 [[BR]] ./configure --prefix=<installdir> 41 57 42 To make sure that the libraries are found during the compilation process you can use configure LIBS="-lhdf5 -lhdf5_hl -ludunits $LIBS". 58 '''Installing the GDAL ADAGUC driver''' 59 60 The driver consists of two files, adagucdataset.h and adagucdataset.cpp. These should be copied to the gdal/frmts/netcdf/ directory, so they reside besides the netCDF and GMT driver. 61 * 1. Copy adagucdataset.h and adagucdataset.cpp to the ./<gdaldir>/frmts/netcdf/ directory 62 * 2. Update the GNUmakefile and makefile.vc in the ./<gdaldir>/frmts/netCDF/ directory by adding the object with name: adagucdataset.o to the already existing objects. 63 * 3. Add the registration entry point declaration GDALRegister_ADAGUC() to gdal/gcore/gdal_frmts.h, at the location above the already existing netCDF driver: 64 65 {{{ 66 … 67 void CPL_DLL GDALRegister_GMT(void); 68 void CPL_DLL GDALRegister_ADAGUC(void); 69 void CPL_DLL GDALRegister_netCDF(void); 70 … 71 }}} 72 * 4. Add a call to the registration function to frmts/gdalallregister.c, in the already existing netcdf ifdef: 73 74 {{{ 75 … 76 #ifdef FRMT_netcdf 77 GDALRegister_GMT(); 78 GDALRegister_ADAGUC(); 79 GDALRegister_netCDF(); 80 #endif 81 … 82 }}} 83 In step 3 and 4 the ADAGUC register entries should be put above the netCDF register entry, to make sure that ADAGUC files are not opened by the netCDF driver. The ADAGUC driver will only open ADAGUC files, by checking the existence of the iso_dataset and product variables. 84 85 '''Configuring GDAL'''[[BR]] 86 To make sure that the libraries are found during the compilation process you can use ./configure LIBS="-lhdf5 -lhdf5_hl -ludunits $LIBS".[[BR]] 43 87 Use --with-netcdf=<path to install tree> to build GDAL with the NetCDF library. 44 88 ---- 89 '''Sample ADAGUC files'''[[BR]] 90 91 ----