Visit PANCROMA Website

Landsat Cloud Mask

Although it us often possible to find a cloud free Landsat scene for a given area, a completely cloud-free image may not be available for your Landsat location of interest and acquisition time. In this case masking the clouds and replacing the masked areas with pixels from a corresponding cloud-free image may be of interest.

PANCROMA™ has two utilities for detecting clouds and for masking the obscured areas. They are included under the Gap Fill menu selection as the filling of the masked areas is done using the Transfer gap fill method described in the previous section and in the following Tutorial.

The first method for creating cloud masks is called the 'Three Band Method'. This technique, as its name implies, requires that three band files be input, and uses information in two of those Landsat bands, the blue band 1 and the thermal band 6 to create a mask directly onto the input band. Clouds are both highly reflective in the short wavelength band 1 and also cold, meaning they will appear darker in the thermal band. The PANCROMA three-band algorithm is loosely based on the method of Martinuzzi, Gould and Gonzales. It compares the band 1 (blue band) and band 6 (thermal infrared or TIR band) digital numbers (DNs) against user-defined thresholds and classifies each pixel as either cloud or non-cloud. The cloud pixels are set equal to zero and the non-cloud pixels are left alone. The result is a band file with the cloud areas blacked out.

To use the utility, you must input the band file to be masked, then the band 1 file, and finally the band 6 file in that order, exactly. (There are actually two band 6 files in each ETM+ data set. They are designated 6a and 6b and they differ in the gain setting of the sensor.) Note that the resolution of the thermal infrared (TIR) band 6 is nominally 60m per pixel, half that of the other multispectral band. In order to perform the mask, the TIR band must be expanded and interpolated to match the size of band 1. Often the TIR columns are off-by-one from being exactly half the band 1 column count. If this is the case, you must manually resize the images so that the band 1 rows and column sizes are exactly twice as large as the TIR row and columns. This can be done using the PANCROMA 'Preprocess' | ' Resize Images' | 'Resize One Image' utility. Note that in order to get an exact match, you may have to resize all of your images downward. The TIR band of the scene used in this example had a row count of 4783 and a column count of 4503. Band 1 had a row count 9566 of and a column count of 9005. In order to get the correct ratio, it was necessary to resize the TIR band to 4783 by 4502 and band 1 (and other masked bands) to 9566 by 9004.

After adjusting the row and column sizes (if necessary) open the files by selecting the 'Gap Fill' | 'Mask Clouds' | 'Three File Method' menu selection. After reading the three files, you will be presented with a data input box. This box will let you set the two comparison thresholds and the cloud buffer radius. The algorithm will select all pixels with DNs below the band1 threshold and above the band6 threshold. You can also set the Cloud Mask Buffer Width. Because the edges of clouds tend to be diffuse, the algorithm will add all pixels within a radius of the Cloud Mask Buffer Width of each selected pixel to the mask.

The thresholds must be determined manually. This can best be done by inspecting the band 1 image and the TIR image and interrogating it using the cursor to determine the DNs of the cloud areas. Once this is done, the correct thresholds can be estimated. However, it may take some trial-and-error to get acceptable results.

Note that if you wish to mask band 1, you must select the file twice, i.e. 'File' | 'Open' | band1; 'File' | 'Open' | band1; 'File' | 'Open' | band6.

The images to the right show an input image with clouds followed by the masked image.

The second Landsat cloud mask approach is called the Five Band Method. In addition to the band to be masked, it requires that Landsat band 1, band 3, band 4 and band 5 also be input. This algorithm is based on the method of Luo and requires the band DNs be converted to top of atmosphere (TOA) reflectance at the sensor in order to make the computation. The relationship is given by:

TOA Reflectance = (p * L(LAMBDA)* d^2) / (ESUN(LAMBDA) * cos (THETA))

Where L(LAMBDA) = TOA radiance
d = earth-sun distance in astronomical units
ESUN(LAMBDA) = mean solar exoatmospheric irradiances
THETA = solar zenith angle

In order to use this method, select 'File' | 'Open' and input, in this order:

band file to be masked;
band 1 file
band 3 file
band 4 file
band 5 file

Select 'Gap Fill' | 'Mask Clouds' | 'Five File Method' from the menu. After the files are opened, you will be prompted to enter the acquisition date of the Landsat image in ordinal days and the solar elevation angle. (Ordinal days are simply the number of elapsed days from the beginning of the year. Note that you must convert the calendar date into ordinal date manually. PANCROMA has a link to the NASA conversion calculator for easy conversion of acquisition dates.) This information can be found in the Landsat metadata file. Also note that although the computation wants the solar zenith angle, you must input the solar elevation angle. This is intended as a slight convenience as the elevation angle is listed in the metadata file, not the zenith angle.

IMPORTANT NOTE: Be sure to input the solar elevation angle NOT the solar azimuth angle, which is also listed in the metadata file.

You also have the opportunity to input the cloud buffer radius in pixels. This works exactly as described above for the Three File Method, including pixels at the outside edges of detected cloud masses so that feathery cloud fringes that would otherwise escape the detection algorithms can be captured.

The images to the right show a band file both before and after Landsat cloud mask processing by the Five File Method. (Note that the image has both snow and clouds. The algorithm has successfully discriminated between the two.)

Below that is an RGB rendering of the cloud-obscured image. The final image at the bottom shows an RGB color rendering of the masked images gap-filled using a cloud-free image acquired at a different date. Close examination of the image shows some residual fringes around the edges of the filled clouds. It is clear that even the clear parts of the Reference image are hazier than the Adjust image, which has resulted in a noticable mismatch in the tones between the filled and unfilled areas. There are other artifacts, for example residual stripes in the snow fields from the original SLC-Off gap filling. Overall however, the image is an improvement over the original. Additional work with haze reduction and increasing the cloud buffer radius a bit might improve it.

[30m cloud image. Click to enlarge.]

[30m cloud mask image. Click to enlarge.]

[30m cloud mask image. Click to enlarge.]

[30m cloud and snow image. Click to enlarge.]

[30m cloud image. Click to enlarge.]

[30m gap filled cloud image. Click to enlarge.]

Web site and all contents Copyright TERRAINMAP Earth Imaging LLC 2010, 2011, All rights reserved.