We have verified that netCDF C libraries starting with v4.6.2 cannot process the CAMx I/O file global attribute “NAME” when file compression is used. This is related to updates to the netCDF C library accessing the HDF5 compression algorithm. This issue has been resolved in CAMx v7.10 but persists for earlier versions of CAMx.
The section below provides a list of commands as guidance to build an earlier version of netCDF that will allow the global attribute “NAME” when using compression. This is not an example command script; the commands should be run independently.
Example c-shell commands
################################################################################
# In order to build the CAMx model with NetCDF support, some version of
# the NetCDF development package must be available on the same system
# where you compile/build the model. This package includes static
# libraries used to link into the CAMx executable, as well as the FORTRAN
# header file (netcdf.inc) needed for compiling CAMx. We recommend that
# the NetCDF package is built from source code using the same compiler
# that is used to compile CAMx.
#
# This document is guidance on how to build NetCDF for use with CAMx. It
# is not a shell script. Instead, it contains a list of the commands that
# should be executed and the order of execution. It is assumed that this
# will be done from the command line.
################################################################################
#
# ---- Make sure you are using C-shell (the commands could easily be
# translated to BASH shell) ----
#
tcsh
#
# ---- Download NetCDF source code and support packages.
# Put these packages in a directory on your system. We will refer to this
# directory as {SRC_DIR}. The build of each package will be in a different
# directory (such as /usr/local). We will refer to the directory where the
# packages will be built as {BLD_DIR} ----
#
https://zlib.net/zlib-1.2.11.tar.gz
https://www.hdfgroup.org/downloads/hdf5/source-code/# (get latest .tar.gz)
https://github.com/Unidata/netcdf-c/archive/v4.6.1.tar.gz
https://github.com/Unidata/netcdf-fortran/archive/v4.4.5.tar.gz
#
# ---- Set the environment variable for the compilers to be used to build
# the packages. We recommend that you use gcc for all C compilations.
# The FORTRAN compiler should be the same compiler used to build CAMx ----
#
setenv FC pgf90
setenv CC gcc
#
# ---- Move to the source code directory ----
#
cd {SRC_DIR}
#
# ---- Build the zlib library (used for compression) ----
#
tar xvzf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix={BLD_DIR}/zlib-1.2.11
make
make install
#
# ---- Build the HDF5 library (used for compression) ----
#
cd {SRC_DIR}
tar xvzf hdf5-1.12.0.tar.gz
cd hdf5-1.12.0
setenv LDFLAGS -L{BLD_DIR}/zlib-1.2.11
./configure --prefix={BLD_DIR}/hdf5-1.12.0 --enable-fortran
make
make install
#
# ---- Build the NetCDF C libraries ----
#
cd {SRC_DIR}
tar xvzf netcdf-c-4.6.1.tar.gz
cd netcdf-c-4.6.1
setenv CFLAGS -I{BLD_DIR}/hdf5-1.12.0/include
setenv LDFLAGS -L{BLD_DIR}/hdf5-1.12.0/lib
./configure --prefix=$CAMx_PKGS/netcdf-c-4.6.1 --disable-dap
make
make install
#
# ---- Build the NetCDF FORTRAN libraries ----
#
cd {SRC_DIR}
tar xvzf netcdf-fortran-4.4.5.tar.gz
cd netcdf-fortran-4.4.5
setenv CPPFLAGS -I{BLD_DIR}/netcdf-c-4.6.1/include
setenv LDFLAGS -L{BLD_DIR}/netcdf-c-4.6.1/lib
setenv LD_LIBRARY_PATH {BLD_DIR}/netcdf-c-4.6.1/lib
./configure --prefix={BLD_DIR}/netcdf-c-4.6.1
make
make install
#
# ---- Make sure that the libraries exist ---
#
ls -l {BLD_DIR}/netcdf-c-4.6.1/lib/libnetcdf.a
ls -l {BLD_DIR}/netcdf-c-4.6.1/lib/libnetcdff.a
################################################################################
