This task uses the Fmask algorithm to calculate 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)
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. The thermal band must range from 10.4 to 12.5 µm. Landsat 8 provides a separate band group with two thermal bands. When both are present, ENVI uses Thermal Infrared (TIR) Band 1 (10.9 µm) for cloud mask generation. If you provide a spectral subset with only one thermal band, it will use that band for cloud mask generation. Landsat 8 OLI and Sentinel-2A sensors also have cirrus bands. The cirrus band must range from 1.36 to 1.385 µm.
ENVI will automatically calibrate the multispectral and cirrus bands (if available) to top-of-atmosphere reflectance while generating the cloud mask. It will calibrate the thermal band (if available) to brightness temperatures. You do not need to perform radiometric or thermal calibration separately as you do with the CalculateCloudMaskUsingFmask task.
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).
Example
This example calculates a cloud mask for a Landsat-8 file. Update the filename and location with your own data.
e = ENVI()
File = 'LC80410302013213LGN00_MTL.txt'
Rasters = e.OpenRaster(File)
Task = ENVITask('CalculateCloudMaskForProduct')
Task.INPUT_RASTERS = Rasters
Task.Execute
dataColl = e.Data
dataColl.Add, Task.OUTPUT_RASTER
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)
View.Zoom, /FULL_EXTENT
The result of this process is a binary image where cloud (masked) pixels have values of 0 and non-cloud (non-masked) pixels have values of 1. To apply the mask to the input reflectance raster, add the following steps. The masked pixels will have NoData values.
OLIRaster = Rasters[0]
maskedRaster = ENVIMaskRaster( $
OLIRaster, Task.OUTPUT_RASTER)
dataColl.Add, maskedRaster
Layer2 = View.CreateLayer(maskedRaster)
outFile = e.GetTemporaryFilename()
maskedRaster.Export, outFile, 'ENVI'
You can use maskedRaster for any subsequent image processing. If you will perform spectral analysis on the data, you should correct for atmospheric effects next by using the QUAC task.
Syntax
Result = ENVITask('CalculateCloudMaskForProduct')
Input properties (Set, Get): CLOUD_THRESHOLD, INPUT_RASTERS, KERNEL_SIZE, OUTPUT_RASTER_URI
Output properties (Get only): OUTPUT_RASTER
Properties marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Properties marked as "Get" are those whose values you can retrieve but not set.
Methods
This task inherits the following methods from ENVITask:
AddParameter
Execute
Parameter
ParameterNames
RemoveParameter
Properties
This task inherits the following properties from ENVITask:
COMMUTE_ON_DOWNSAMPLE
COMMUTE_ON_SUBSET
DESCRIPTION
DISPLAY_NAME
NAME
REVISION
TAGS
This task also contains the following properties:
CLOUD_THRESHOLD (optional)
Specify a floating-point threshold for cloud probability over clear-land and clear-water regions. The default value is 22.5.
INPUT_RASTERS (required)
Specify an array of rasters containing multispectral, thermal (optional), and cirrus (optional) datasets. For Landsat, select the *_MTL.txt file. For Sentinel-2, select the S2A_*.xml file.
KERNEL_SIZE (optional)
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.
OUTPUT_RASTER
This is a reference to the output raster of filetype ENVI.
OUTPUT_RASTER_URI (optional)
Specify a string with the fully qualified filename and path of the associated OUTPUT_RASTER. If you do not specify this property, or set it to an exclamation symbol (!), a temporary file will be created.
Version History
API Version
4.3
See Also
ENVITask, CalculateCloudMaskUsingFmask Task, MaskRaster Task