Notes on Building NetCDF4 for WRF  
            Before building NetCDF on your system, you should make note of the following:
  
            (1) Choosing whether to build NetCDF-3 or NetCDF-4 is simply a choice of which file format you wish to use.  It has nothing to do with the version of the NetCDF software.
  
           (2) NetCDF-4 files are actually written in HDF5.
  
            (3) NetCDF software version 4.x supports both NetCDF-3 and NetCDF-4 file formats, while NetCDF version 3.x or earlier only supports the NetCDF-3 file format.
            
              
            
            You should build WRF with NetCDF-3 if the following applies to you: 
               
            - All of the data you will need to access is available in NetCDF classic or 64-bit offset formats
  
            - You would like to delay upgrading to NetCDF-4 until NetCDF-4 formats are more widely used
  
            - You are not able to install the HDF5 1.8 software, which is required to build and install NetCDF-4    
            
           You should build WRF with NetCDF-4 if the following applies to you:
  
           - You need to access NetCDF data that makes use of NetCDF-4 compression or chunking
  
           - You need to access data in all NetCDF formats, including NetCDF-4 or NetCDF-4 classic model formats     
           
             
           Requirements for building NetCDF-4:
  
           (a) NetCDF 4.1 or later must be installed and configured with 
                 --enable-netcdf-4
  
           (b) A NetCDF Fortran interface must be installed.
  
           (c) HDF5-1.8.1 or later must be installed.
  
           (d) HDF5 must have been built with zlib (version 1.2.3 or later).
  
           *Some of the required software libraries may already be on your system.  On Linux and Mac systems, you can use the "locate" command to search for these libraries, i.e.:
                  To find zlib: locate libz.{a,so} 
                 To find hdf5:  locate libhdf5.{a,so} libhdf5_hl.{a,so} 
                 To find NetCDF:  locate libnetcdf.{a,so} libnetcdf.{a,so} 
  
            
            Specifying the Environment for Building:
  
            - The configure script will use 'gcc' and 'GNU' tools if they are available.
  
            - Many users may wish to use a vendor-supplied compiler (such as Intel).  This can be done by setting environment variables, such as CC, FC, etc. before the build.  
            
            Downloading and Building Necessary External Software:
  
            The configure script will search for the necessary tools in your path.  When you run configure, you may optionally use the --prefix argument to change the default installation directory.  The following example shows how to install the zlib, HDF5, and NetCDF-4 libraries in the user's home directory (in /lib and /include), using an Intel compiler:
  
            *Note:  if you do not provide the --prefix option, installation will be in /usr/local, in subdirectories  /lib, /include, and bin/.
 
 
  
            
            
            zlib:
  
            *A tested version of zlib can be found at the NetCDF-4 ftp site.
  
           ./configure --prefix=$HOME
  
            make
  
            make install
 
  
            
            HDF5:
  
            *A tested version of HDF5 can be found at the NetCDF-4 ftp site.
  
            *For building NetCDF, it is NOT necessary to build the HDF5 Fortran, C++, or Java API's.  ONLY the HDF5 C library is used.
  
                    
            ./configure --prefix=$HOME/hdf/hdf5-1.8.9 \ 
                 --with-zlib=$HOME
  
            make
  
            make install
 
  
            
            NetCDF-4:
  
            *It is recommended to install NetCDF Version 4.2.1 or later. The below example is for Version 4.2.1.1.
  
            *A tested version of NetCDF-4 can be found at the NetCDF-4 ftp site.
 
 
  
            To install NetCDF 4.2.1.1
  
            setenv LD_LIBRARY_PATH $HOME/hdf/hdf5-1.8.9/lib:$LD_LIBRARY_PATH
  
            ./configure --prefix=$HOME/netcdf/netcdf-4.2.1.1_intel \ 
                --enable-netcdf-4 \ 
                LDFLAGS="-L$HOME/hdf/hdf5-1.8.9/lib -L$HOME/lib" \ 
                CPPFLAGS="-I$HOME/hdf/hdf5-1.8.9/include -I$HOME/include" \ 
                CC=icc
  
           make
  
           make install
 
  
           To install NetCDF-fortran-4.2
  
           setenv LD_LIBRARY_PATH $HOME/netcdf/netcdf-4.2.1.1_intel/lib:$LD_LIBRARY_PATH
  
           ./configure --prefix=$HOME/netcdf/netcdf-4.2.1.1_intel \ 
                LDFLAGS="-L$HOME/netcdf/netcdf-4.2.1.1_intel/lib" \ 
                CPPFLAGS="-I$HOME/netcdf/netcdf-4.2.1.1_intel/include" \ 
                FC=ifort 
                F77=ifort
 
 
  
           
           Building WRF
  
           -To turn on NetCDF-4 features, and for using NetCDF-4 formatted output for WRF, set the following environment variables before issuing the configure script:
  
           For csh 
               setenv NETCDF4 1
 
  
          For bask/ksh 
               export NETCDF4=1
 
  
          -To turn off NetCDF-4 features and to use the NetCDF Classic output format for WRF, simply unset the NetCDF4 environment variable, or set it to 0 before issuing the configure script.
 
  
           
            Specifying the Environment for Runtime
  
           -If WRF was built with NetCDF-4 features, you will need to add the location of the NetCDF-4 library and the HDF5 library to the shared library environment variable in the login shell environment file (e.g., .cshrc, .login).  Use the environment variable that is applicable to your system:
  
           Linux:  LD_LIBRARY_PATH 
           Mac:  DYLD_LIBRARY_PATH 
           AIX:,  LIBPATH 
           HP-UX:  SHLIB_PATH
  
           
          *The following is an example on a Linux machine:
  
          For csh 
          
          setenv LD_LIBRARY_PATH $HOME/netcdf/netcdf-4.2.1.1_intel/lib:$HOME/hdf/hdf5-1.8.9/lib:$LD_LIBRARY_PATH
 
  
          For bash/ksh
  
          export LD_LIBRARY_PATH=$HOME/netcdf/netcdf-4.2.1.1_intel/lib:$HOME/hdf/hdf5-1.8.9/lib:$LD_LIBRARY_PATH
 
  
           
          
          Creating NetCDF Classic Output Format with the WRF NetCDF-4 Format Build
  
          -If you turned on NetCDF-4 features while configuring WRF, the default NetCDF output format will be in NetCDF-4.  To output the NetCDF Classic format at runtime (for a WRF NetCDF-4 format build), set use_netcdf_classic=.true. in the &time_control section of namelist.input.
          
          
          
         
          
         
         
            
             
             
              
              
            
 
                 
                
 
  
            
    
            
  
  
  
             
              
             
               
               |