Update: The Landsat Ecosystem Disturbance Adaptive Processing System (LEDAPS) is a software system for generating surface reflectance data for Landsat 4, 5, and 7 TM or ETM+ sensors. The installation can be difficult, so I've prepared a guide based on my last successful installation of version 2.2.0. Since I first authored this article, I've heard reports of various difficulties I didn't encounter, including that the auxiliary files are no longer available. On the other hand, new releases are now on GitHub and the documentation seems to have improved (over the original on Google Code). I am now downloading surface reflectance data directly and in bulk from the USGS EROS Science Products Architecture (ESPA), so I haven't needed to use LEDAPS myself in awhile. In short, this article may need to be updated, but what follows is a guide for installing LEDAPS 2.2.0 on Ubuntu GNU/Linux 14.04 or higher.

LEDAPS Dependencies

The Google Code Wiki for LEDAPS lists the following dependencies:

  • HDF-EOS2 libraries (hdf-eos)
  • ESPA common libraries (espa-common)
  • GCTP libraries (Bundled with HDF-EOS2)
  • TIFF libraries (libtiff5)
  • GeoTIFF libraries (libgeotiff2)
  • HDF4 libraries (libhdf4)
  • libxml2

Some of these dependencies have their own dependencies, which adds "JPEG support" (for espa-common) and zlib (for HDF4) to the list.

A Walkthrough

This walkthrough is written and tested for Ubuntu GNU/Linux 14.04 ("trusty"). It is available in full as a public Gist. You'll want to make sure you have the basic dependencies installed first.

sudo apt-get install zlib1g zlib1g-dev libtiff5 libtiff5-dev \
libgeotiff2 libgeotiff-dev libxml2 libxml2-dev

I could not figure out which JPEG library is needed by espa-common but it is likely installed by default on Ubuntu. For the following examples, I assume you want to build the libraries in /usr/local/ and you have sudo privileges. Don't forget to set a USERNAME variable.

USERNAME=heyyouguys

HDF4 Library

First, we install HDF4 support. You could install this as a package with sudo apt-get install libhdf4-0 libhdf4-0-alt libhdf4-alt-dev. I prefer to build it from source in this case. This also ensures that the paths I've provided for shared libraries later on in the walkthrough will match.

sudo mkdir /usr/local/hdf4
sudo chown $USERNAME /usr/local/hdf4
cd /usr/local/hdf4

# Download the latest HDF4 source code
wget http://www.hdfgroup.org/ftp/HDF/HDF_Current/src/hdf-4.2.11.tar.gz
tar -xzvf hdf-4.2.11.tar.gz
cd hdf-4.2.11
./configure
make
make check
make install

# Update shared links
sudo ldconfig

HDF-EOS2 Library

Next, we install the HDF-EOS2 library. They actually do provide some fairly helpful instructions for building from source, from which I've adapted these instructions. Note that your path to the h4cc compiler may differ, especially if you did not build HDF4 from source. HDF-EOS2 is available as a package (sudo apt-get install libhdfeos0 libhdfeos-dev libgctp0d libgctp-dev) but I could not get LEDAPS to build off of this package.

sudo mkdir /usr/local/hdf-eos
sudo chown $USERNAME /usr/local/hdf-eos
cd /usr/local/hdf-eos

# Download latest HDF-EOS source code
wget ftp://edhs1.gsfc.nasa.gov/edhs/hdfeos/latest_release/HDF-EOS2.19v1.00.tar.Z
tar -xzvf HDF-EOS2.19v1.00.tar.Z
cd hdfeos
./configure -enable-install-include \
CC=/usr/local/hdf4/hdf-4.2.11/hdf4/bin/h4cc
make
make check
make install

# Update shared links
sudo ldconfig

Pay attention to this message after make install, which might be slightly different on your machine. You'll want to remember this path for later.

Libraries have been installed in:
   /usr/local/hdf4/hdf-4.2.11/hdf4/lib

ESPA Common Library

Next is the ESPA Common Library, its documentation here. The original documentation consists of only one instruction: "Goto the src/raw_binary directory and build the source code there." Anyway, the first thing we have to do is get the source code. Note that while I've linked to the 1.1.0 version documentation, the instructions are (apparently) the same for version 1.3.1, which is what we're installing.

sudo svn checkout http://espa-common.googlecode.com/svn/releases/version_1.3.1 \
/usr/local/espa-common/version_1.3.1
sudo chown -R $USERNAME espa-common

To inform epsa-common and, later, LEDAPS on where to find shared libraries, we have to set a number of environmental variables. At least one of the following paths will likely not match your setup. The only hints I can give you are that the *INC paths should point to the respective library's includes while the *LIB paths should point to the exported library.

export HDFEOS_GCTPINC="/usr/include/gctp/"
export HDFEOS_GCTPLIB="/usr/local/hdf-eos/hdfeos/hdfeos2/lib"
export TIFFINC="/usr/include/x86_64-linux-gnu/"
export TIFFLIB="/usr/lib/x86_64-linux-gnu/"
export GEOTIFF_INC="/usr/include/geotiff/"
export GEOTIFF_LIB="/usr/lib/"
export HDFINC="/usr/local/hdf4/hdf-4.2.11/hdf4/include/"
export HDFLIB="/usr/local/hdf4/hdf-4.2.11/hdf4/lib/"
export HDFEOS_INC="/usr/local/hdf-eos/hdfeos/include/"
export HDFEOS_LIB="/usr/local/hdf-eos/hdfeos/hdfeos2/lib"
export JPEGINC="/usr/include/"
export JPEGLIB="/usr/lib/x86_64-linux-gnu/"
export XML2INC="/usr/include/libxml2/"
export XML2LIB="/usr/lib/x86_64-linux-gnu/"

It's easy to mistake where HDF-EOS2 keeps its lib files. Remember the path we wrote down after make install? You have to carefully read the output from make install to note that it installs the lib files in a subfolder called hdfeos2 (by default, I assume). If the above path doesn't work for you, just run make install on HDF-EOS2 again and look for the message that indicates the proper path.

We next cd to the src/raw_binary subfolder. From there, with a little luck, building is straightforward.

make
make install
sudo ldconfig

If you encounter errors about the -lGctp switch, then make is unable to find the GCTP lib files; you specified the wrong path under HDFEOS_GCTPLIB.

LEDAPS

Finally, we're ready to install LEDAPS. Again, though I will link you to the version 2.2.0 documentation, we're going to install version 2.2.1. This bug report might also be helpful if you run into errors. The GitHub site (formerly on the Google Code Wiki) indicates that you should download the LEDAPS auxiliary files (ledaps_aux.1978-2014.tar.gz) before building LEDAPS, there is no reason to do this before LEDAPS has been successfully installed (it's a ~2.9 GB file). We first have to export the paths to the includes and lib files we just built in espa-common.

export ESPAINC="/usr/local/espa-common/version_1.3.1/src/raw_binary/include/"
export ESPALIB="/usr/local/espa-common/version_1.3.1/src/raw_binary/lib/"

Now you're ready to build LEDAPS! Good luck.

sudo svn checkout http://ledaps.googlecode.com/svn/releases/version_2.2.1 \
/usr/local/ledaps/version_2.2.1
sudo chown -R $USERNAME ledaps
cd /usr/local/ledaps/version_2.2.1/ledapsSrc/src/
make
make install
make clean
sudo ldconfig

Clean-Up

A description of the LEDAPS outputs, which you won't find linked to from the USGS or the Google Code site, is available here.