This section describes how to build the source code and create LDT’s executable: named LDT.
Please see Section [sec-important_note_fs] for information regarding using a case sensitive file system for compiling/running LDT.
Please first read the companion document LISF Installation Guide. This document describes the required and optional libraries used by LISF. It also describes the supported development environments.
Perform the steps described in Section [sec-obtain-src] to obtain the source code.
Go to the $WORKING directory. This directory contains two scripts for building the LDT executable: configure and compile.
Set the LDT_ARCH environment variable based on the system you are using. The following commands are written using Bash shell syntax.
% export LDT_ARCH=linux_ifc
% export LDT_ARCH=linux_gfortran
% export LDT_ARCH=cray_ifc
% export LDT_ARCH=cray_cray
% export LDT_ARCH=ibm_gfortran
It is suggested that you set this environment variable in a modulefile [1] to load or in an environment script to source before compiling and/or running LDT.
Run the configure script first by typing:
% ./configure
This script will prompt the user with a series of questions regarding support to compile into LDT, requiring the user to specify the locations of the required and optional libraries via several LDT specific environment variables. The following environment variables are used by LDT.
Variable | Description | Usage |
---|---|---|
|
Fortran 90 compiler |
required |
|
C compiler |
required |
|
path to ESMF module files |
required |
|
path to ESMF library files |
required |
|
path to openJPEG library |
required |
|
path to ecCodes library |
required |
|
path to NetCDF library |
required |
|
path to HDF4 library |
optional (required to use HDFEOS2) |
|
path to HDF5 library |
optional |
|
path to HDFEOS2 library |
optional |
|
path to GDAL library |
optional |
|
path to FortranGIS library |
optional (required to use GDAL) |
|
path to GeoTIFF library |
optional |
|
path to JPEG library |
optional (use system libjpeg by default) |
|
path to TIFF library |
optional (use system libtiff by default) |
|
path to JBIG library |
optional (use system libjbig by default) |
|
path to LZMA library |
optional (use system liblzma by default) |
|
path to RPC library |
optional (use system RPC library by default) |
Note that the CC
variable must be set to a C compiler, not a C++ compiler. A C++ compiler may mangle internal names in a manner that is not consistent with the Fortran compiler. This will cause errors during linking.
It is suggested that you set these environment variables in a modulefile [1] to load or in an environment script to source before compiling and/or running LDT.
You may encounter errors either when trying to compile LDT or when trying to run LDT because the compiler or operating system cannot find these libraries. To fix this, you must add these libraries to your $LD_LIBRARY_PATH
environment variable. For example, say that you are using ESMF, ecCodes, NetCDF, and HDF5. Then you must execute the following command (written using Bash shell syntax):
% export LD_LIBRARY_PATH=$LDT_HDF5/lib:$LDT_LIBESMF:$LDT_NETCDF/lib:$LDT_ECCODES/lib:$LD_LIBRARY_PATH
It is suggested that you set this environment variable in a modulefile [1] to load or in an environment script to source before compiling and/or running LDT.
An example execution of the configure script is shown below:
% ./configure ------------------------------------------------------------------------ Setting up configuration for LDT Parallelism (0-serial, 1-dmpar, default=0): Optimization level (-3=strict checks with warnings, -2=strict checks, -1=debug, 0,1,2,3, default=2): Assume little/big_endian data format (1-little, 2-big, default=2): Use GRIBAPI/ECCODES? (0-neither, 1-gribapi, 2-eccodes, default=2): NETCDF version (3 or 4, default=4)?: NETCDF use shuffle filter? (1-yes, 0-no, default = 1): NETCDF use deflate filter? (1-yes, 0-no, default = 1): NETCDF use deflate level? (1 to 9-yes, 0-no, default = 9): Use HDF4? (1-yes, 0-no, default=1): Use HDF5? (1-yes, 0-no, default=1): Use HDFEOS? (1-yes, 0-no, default=1): Enable GeoTIFF support? (1-yes, 0-no, default=1): Enable LIBGEOTIFF support? (1-yes, 0-no, default=1): Include date/time stamp history? (1-yes, 0-no, default=1): ----------------------------------------------------- configure.ldt file generated successfully ----------------------------------------------------- Settings are written to configure.ldt in the make directory. If you wish to change settings, please edit that file. To compile, run the compile script. ------------------------------------------------------------------------
At each prompt, select the desired value. If you desire the default value, then you may simply press the Enter key.
Most of the configure options are be self-explanatory. Here are a few specific notes:
-
for
Parallelism (0-serial, 1-dmpar, default=1):
, dmpar refers to enabling MPI
-
for
Assume little/big_endian data format (1-little, 2-big, default=2):
, select the default value of 2. By default, LDT reads and writes binary data in the big endian format. Only select the value of 1, if you have reformatted all required binary data into the little endian format. -
for
Use GRIBAPI/ECCODES? (0-neither, 1-gribapi, 2-eccodes, default=2):
, select the default value of 2. Technically, GRIB support is not required by LDT; however, most of the commonly used met forcing data are in GRIB, making GRIB support a practical requirement. ecCodes is ECMWF’s replacement to their GRIB-API library. GRIB-API is supported only for historical reasons; thus, please use ecCodes.ImportantGRIB-API support is now deprecated. Future releases will support only ecCodes. -
for
Enable GeoTIFF support? (1-yes, 0-no, default=1):
, GeoTIFF means the GeoTIFF support provided by the GDAL library. -
for
Enable LIBGEOTIFF support? (1-yes, 0-no, default=1):
, LIBGEOTIFF means GeoTIFF support provided by the GeoTIFF library.
Note that due to an issue involving multiple definitions within the NetCDF 3 and HDF 4 libraries, you cannot compile LDT with support for both NetCDF 3 and HDF 4 together.
Note that if you compiled NetCDF 4 without compression, then when specifying NETCDF version (3 or 4, default=4):
, select 3. Then you must manually append -lnetcdff
to the LDFLAGS
variable in the make/configure.ldt file.
Compile the LDT source code by running the compile script.
% ./compile
This script will compile the libraries provided with LDT and then the LDT source code. The executable LDT will be placed in the $WORKING directory upon successful completion of the compile script.
Finally, copy the LDT executable into your running directory, $RUNNING. (See Section [sec-run].)