>  Docs Center  >  Using ENVI  >  Create a Cloud Mask for Landsat
ENVI

Create a Cloud Mask for Landsat

Calculate Cloud Mask Using Fmask

Use the Calculate Cloud Mask Using Fmask tool to create a cloud mask for the following sensors:

  • Landsat 4-5 TM
  • Landsat 7 ETM+
  • Landsat 8
  • Sentinel-2 Level-1C
  • NPP VIIRS Moderate Resolution (750 m) reflectance and brightness temperature SDR data downloaded from NOAA CLASS (HDF5 format)

ENVI uses the Fmask algorithm cited in the References section below.

You can also write a script to calculate a cloud mask for Landsat using the ENVICalculateCloudMaskForProductTask routine.

Before You Begin


The input image must contain multispectral bands within the following wavelength ranges:

  • Blue: 0.45 - 0.523 µm
  • Green: 0.52 - 0.605 µm
  • Red: 0.63 - 0.69 µm
  • NIR: 0.75 - 0.9 µm
  • SWIR1: 1.55 - 1.75 µm
  • SWIR2: 2.05 - 2.380 µm

If the image has thermal and cirrus bands, these will improve the accuracy of the cloud mask result. Landsat 8 OLI and Sentinel-2A sensors have cirrus bands. The thermal band must range from 10.4 to 12.5 µm. The cirrus band must range from 1.36 to 1.385 µm.

ENVI will automatically calibrate the multispectral and cirrus band (if available) to top-of-atmosphere reflectance. It will calibrate the thermal band (if available) to brightness temperatures. You do not need to calibrate the data separately.

Open Files


  1. Select File > Open from the menu bar.
  2. In the Open dialog, select the data file.
    • Select a *_MTL.txt metadata file for a Landsat 4-5 TM, Landsat 7 ETM+, or Landsat 8 dataset.
    • Select an S2A_*.xml file for a Sentinel-2 dataset.
    • Select an .h5 file for NPP VIIRS data.

NPP VIIRS

The cloud mask tool supports NPP VIIRS Moderate Resolution (750 m) reflectance and brightness temperature SDR data downloaded from NOAA CLASS (HDF5 format). After you select an .h5 file, the Select NPP VIIRS Parameters dialog appears. Follow these steps to continue:

  1. From the Select Product drop-down list, select Reflectance/Thermal.
  2. Select the Geocorrect and Mitigate Bowtie Effect option to georeference the source imagery, which will also remove any bowtie artifacts. Georeferencing is only available if the file you selected has Latitude and Longitude bands. A Quality band is further needed to perform bowtie correction.
  3. The default Projection Type is Geographic WGS-84. Choose Polar Stereographic WGS-84 if the imagery covers the polar regions.
  4. Select an Interpolation Method. The GLT algorithm establishes a regular output grid and finds the best location for each source image pixel. Any output grid point for which a source pixel could not be found will be filled with one of the following methods:
    • Distance Weighted (default): A distance-weighted average of the surrounding valid values. Use this method to create an image with the fewest visible interpolation artifacts.
    • Nearest Neighbor: Select this method when the set of valid pixel values cannot be modified, for example, when values represent the integral values of a classification.
  5. Select an output directory for the georeferenced and bowtie-corrected image.
  6. Disable the Display Geocorrected Image option.
  7. Click OK. The Process Manager in the lower-right corner of the ENVI application shows the processing status of GLT reprojection. This process occurs twice: once for the reflectance dataset and another for the brightness temperature dataset.

Create a Cloud Mask


  1. From the Toolbox, select Feature Extraction > Calculate Cloud Mask Using Fmask Algorithm.
  2. Click the Browse button next to the Input Rasters field.
  3. In the File Selection dialog, click the Select All button to select all datasets that are listed for your Landsat, Sentinel-2, or NPP VIIRS file.
  4. Click OK in the File Selection dialog.

Set Parameters

  1. For the Kernel Size field, specify the number of pixels along one side of a square kernel. The default value is 7 (to create a 7 x 7 array). Cloud regions are dilated by this kernel size before output.
  2. For the Cloud Probability Threshold field, specify a threshold for cloud probability over clear-land and clear-water regions. The default value is 22.5.
  3. Select an output filename and location for the cloud mask raster.
  4. Enable the Display result option.
  5. Click OK. When processing is complete, the cloud mask is displayed and added to the Layer Manager. The cloud mask is a binary image where cloud (masked) pixels have values of 0 and non-cloud (non-masked) pixels have values of 1.
  6. Right-click on the cloud mask in the Layer Manager and select Zoom to Layer Extent to view the entire mask.

Apply the Cloud Mask to the Multispectral Source Image


  1. From the menu bar, select File > Save As > Save As (ENVI, NITF, TIFF, DTED).
  2. In the File Selection dialog, select the multispectral dataset to which to apply the cloud mask. Do not click OK yet.
  3. Click the Mask button.
  4. In the Mask Selection dialog, select the cloud mask raster. If it is not listed in the File Selection dialog, click the Open button and navigate to where you saved the cloud mask raster on disk.
  5. Click OK in the Mask Selection dialog, then click OK in the File Selection dialog.
  6. In the Save File As Parameters dialog, select an output format. The choices are NITF, ENVI, or TIFF.
  7. Select an output filename and location for the masked image.
  8. Enable the Display result option.
  9. Click OK.

When processing is complete, the masked cloud pixels are set to values of NoData in the displayed image. You can use this mask raster for any subsequent image processing. If you will perform spectral analysis on the data, you should correct for atmospheric effects next by using the QUick Atmospheric Correction (QUAC) tool.

The ENVI header file for the cloud mask will contain a new cloud cover field with the reported percentage of cloud cover. You can also view the cloud cover percentage by right-clicking on the cloud mask file in the Layer Manager, selecting View Metadata, and clicking the Image Parameters node.

References


ENVI uses the Fmask algorithm cited in the following references:

Zhu, Z., S. Wang, and C. E. Woodcock. "Improvement and Expansion of the Fmask Algorithm: Cloud, Cloud Shadow, and Snow Detection for Landsats 4-7, 8, and Sentinel 2 Images." Remote Sensing of Environment 159 (2015): 269-277, doi:10.1016/j.rse.2014.12.014 (paper for Fmask version 3.2).

Zhu, Z., and C. E. Woodcock. "Object-Based Cloud and Cloud Shadow Detection in Landsat Imagery." Remote Sensing of Environment 118 (2012): 83-94, doi:10.1016/j.rse.2011.10.028 (paper for Fmask version 1.6).



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us