Welcome to the Harris Geospatial documentation center. Here you will find reference guides and help documents.


  >  Docs Center  >  ENVI API  >  Processing  >  ENVICalculateCloudMaskForProductTask

ENVICalculateCloudMaskForProductTask

ENVICalculateCloudMaskForProductTask

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)

It automatically performs the radiometric calibration required for the Fmask algorithm. You do not need to calibrate the imagery before executing this task, as you do with ENVICalculateCloudMaskUsingFmaskTask.

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.

; Start the application
e = ENVI()
 
; Open a Landsat 8 raster
File = 'LC80410302013213LGN00_MTL.txt'
Rasters = e.OpenRaster(File)
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('CalculateCloudMaskForProduct')
 
; Define inputs
Task.INPUT_RASTERS = Rasters
 
; Run the task
Task.Execute
 
; Get the collection of data objects currently available in the Data Manager
dataColl = e.Data
 
; Add the output to the Data Manager
dataColl.Add, Task.OUTPUT_RASTER
 
; Display the result
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)
 
; Export the masked raster to disk
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 ENVIQUACTask routine.

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


ENVI 5.3, Service Pack 2

Introduced

API Version


3.3

See Also


ENVITask, ENVITask::Parameter, ENVICalculateCloudMaskUsingFmaskTask, ENVIMaskRasterTask



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