CreateMaskAsArcGISRaster Method

Creates a mask, in ArcGIS raster format, for a CoastWatch POES AVHRR image.

Class:CoastWatchAVHRR
Intended use:Recommended for external callers
COM:Exposed as the CreateMaskAsArcGISRaster method of COM class GeoEco.CoastWatchAVHRR
ArcGIS:Exposed as the Create CoastWatch Mask as ArcGIS Raster geoprocessing tool
Method type:Classmethod

Usage

CoastWatchAVHRR.CreateMaskAsArcGISRaster(coastWatchFile, outputRaster[, storeNoDataForUnmaskedPixels[, maskMissingData[, maskLand[, cloudMaskFile[, cloudVariable[, sunZenithFile[, sunZenithVariable[, useDayCloudTest1[, useDayCloudTest2[, useDayCloudTest3[, useDayCloudTest4[, useDayCloudTest5[, useDayCloudTest6[, useDayCloudTest7[, maskWhenDayCloudMaskExceeds[, useNightCloudTest1[, useNightCloudTest2[, useNightCloudTest3[, useNightCloudTest4[, useNightCloudTest5[, useNightCloudTest6[, useNightCloudTest7[, maskWhenNightCloudMaskExceeds[, minCloudyNeighbors[, projectedCoordinateSystem[, geographicTransformation[, resamplingTechnique[, projectedCellSize[, registrationPoint[, clippingRectangle[, mapAlgebraExpression[, buildPyramids[, overwriteExisting]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]])

Arguments

coastWatchFile
Python type:unicode
Minimum length:1
Maximum length:255
Must exist:Yes

CoastWatch POES AVHRR CWF or HDF file for which the mask should be created.

Only CoastWatch POES AVHRR files are supported. An error will be raised for other CoastWatch files, such as those for the GOES satellite series.

If you provide a compressed file in a supported compression format, it will be automatically decompressed. If it is an archive (e.g. .zip or .tar), it must contain exactly one file, which must not be in a subdirectory.

outputRaster
Python type:unicode
Minimum length:1
Maximum length:255
Must exist:No

Output ArcGIS raster. The pixels will be 8-bit unsigned integers, where the value 1 indicates the pixel is masked.

storeNoDataForUnmaskedPixels
Python type:bool
Default value:True

If True, pixels that are not masked will be stored as NoData. If False, they will be stored as the value 0.

maskMissingData
Python type:bool
Default value:True

If True, pixels that are missing data will be masked.

The most common cause for missing data is the satellite swath not completely covering the region of interest. The pixels that could not be seen by the sensor when the satellite flew over will be marked as missing data.

maskLand
Python type:bool
Default value:True

If True, pixels that are classified as land by the CoastWatch graphics variable will be masked.

The graphics variable is obtained by invoking the CoastWatch Utilities cwgraphics program on the input file. I have observed that this program does not always produce a land mask that is 100% identical to the graphics variable contained by the input file. For example, when I executed cwgraphics on 2005_108_1841_n16_er.hdf, I noticed that several pixels, mostly near the edges of the images, differed from those obtained by viewing the graphics variable in 2005_108_1841_n16_er.hdf using the cdat program.

I do not know the reason for this discrepancy. My theory is that the cwgraphics program does not read the graphics variable from the input file at all. Rather, it only reads the geographic extent and then produces a new land mask from its database in the installation directory of the CoastWatch Utilities. Newer versions of the CoastWatch Utilities may include updated land masks that differ from those used by CoastWatch in the past. But this is only a theory. In any case, the discrepancy seems to be quite insignificant and should not affect most users.

cloudMaskFile
Python type:unicode or None
Default value:None
Minimum length:1
Maximum length:255
Must exist:Yes

CoastWatch POES AVHRR CWF or HDF file that contains the CoastWatch cloud mask.

A value need only be provided for this parameter when the cloud mask is not stored in the input CoastWatch file. This will usually be the case for CWF files, because they usually do not contain more than one CoastWatch variable per file. HDF files usually contain all of the variables, so you can usually omit this parameter for HDF files.

If you provide a compressed file in a supported compression format, it will be automatically decompressed. If it is an archive (e.g. .zip or .tar), it must contain exactly one file, which must not be in a subdirectory.

cloudVariable
Python type:unicode or None
Default value:u'cloud'
Minimum length:1

Name of the CoastWatch variable to extract from the cloud mask file and use as the cloud mask (e.g. "cloud").

The current implementation of this tool was designed to operate on the 8-bit CLAVR cloud mask represented by the "cloud" variable in CoastWatch files. It was not designed to operate on the "cloudx" variable, which is a new experimental CLAVR-x cloud mask available in recent CoastWatch HDF files. Nonetheless, if you wish to operate on the cloudx variable, you can specify it instead of cloud, and pick mask options appropriate for it instead.

sunZenithFile
Python type:unicode or None
Default value:None
Minimum length:1
Maximum length:255
Must exist:Yes

CoastWatch POES AVHRR CWF or HDF file that contains the solar zenith image, typically represented by the sun_zenith variable.

A value need only be provided for this parameter when the solar zenith is not stored in the input CoastWatch file. This will usually be the case for CWF files, because they usually do not contain more than one CoastWatch variable per file. HDF files usually contain all of the variables, so you can usually omit this parameter for HDF files.

If you provide a compressed file in a supported compression format, it will be automatically decompressed. If it is an archive (e.g. .zip or .tar), it must contain exactly one file, which must not be in a subdirectory.

According to CoastWatch researcher Peter Hollemans, when an image's scene time is "day", all pixels of the cloud mask use daytime cloud tests, and when it is "night", all pixels use nighttime cloud tests. When the scene time is "day/night", the decision of which tests to use is based on the solar zenith for that pixel.

According to Peter, for CoastWatch HDF files, pixels with a solar zenith > 80 degrees use the nighttime cloud tests, and <= 80 use the daytime cloud tests. This tool implements that logic. If you specify that cloud masking should be performed for a day/night image but no solar zenith image is available, this tool will assume that nighttime cloud tests were used for every pixel and a warning will be issued. For some reason, CoastWatch occasionally produces day/night images with no sun_zenith or other variables that are present in day images. My recollection is that Peter said it is safe to assume for these images that all pixels are nighttime.

The solar zenith image is ignored for scene times other than "day/night" (e.g. "day" or "night").

After some investigation, I find that the cloud mask pixels near the 80 degree solar zenith line are problematic, for two reasons:

Peter said he did not know what was done for CoastWatch day/night CWF files. I examined a few of these from the North East region, and it appeared that they also switched from daytime to nighttime cloud tests in the middle of the image. But the NOAA distribution site (http://www.class.noaa.gov) only appeared to have CWFs containing the sun_zenith variable for dates after late 1999.

Peter mentioned that the cwangles program from the CoastWatch Utilities could compute the solar zenith, but the values would only be approximate beacuse the program assumed that all pixels were obtained by the sensor at the same moment in time. I tried this approach but the 80 degree solar zenith line did not line up with the line where the cloud tests appeared to switch. Because of this, I do not believe that day/night CWF files will be useable for users who want to use some cloud tests and ignore others.

sunZenithVariable
Python type:unicode or None
Default value:u'sun_zenith'
Minimum length:1

Name of the CoastWatch variable to extract from the solar zenith file and use as the solar zenith image (e.g. "sun_zenith").

useDayCloudTest1
Python type:bool
Default value:True

If True, daytime pixels that failed the CLAVR-1 Reflective Gross Cloud Test (bit 1 of the cloud mask) will be masked. If False, this cloud test will be ignored.

According to CoastWatch researcher Peter Hollemans, the same CLAVR-1 test is used for both CWF and HDF files, but for HDF files, the CLAVR-x thresholds are used instead of than of the CLAVR-1 thresholds.

This parameter is ignored for nighttime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

useDayCloudTest2
Python type:bool
Default value:True

If True, daytime pixels that failed the CLAVR-1 Reflectance Uniformity Test (bit 2 of the cloud mask) will be masked. If False, this cloud test will be ignored.

According to CoastWatch researcher Peter Hollemans, the same CLAVR-1 test is used for both CWF and HDF files, but for HDF files, the CLAVR-x thresholds are used instead of than of the CLAVR-1 thresholds.

This parameter is ignored for nighttime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

useDayCloudTest3
Python type:bool
Default value:True

If True, daytime pixels that failed the CLAVR-1 Reflectance Ratio Cloud Test (bit 3 of the cloud mask) will be masked. If False, this cloud test will be ignored.

According to CoastWatch researcher Peter Hollemans, the same CLAVR-1 test is used for both CWF and HDF files, but for HDF files, the CLAVR-x thresholds are used instead of than of the CLAVR-1 thresholds.

This parameter is ignored for nighttime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

useDayCloudTest4
Python type:bool
Default value:True

If True, daytime pixels that failed the CLAVR-1 Channel 3 Albedo Test (bit 4 of the cloud mask) will be masked. If False, this cloud test will be ignored.

This parameter is ignored for nighttime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

useDayCloudTest5
Python type:bool
Default value:True

If True, daytime pixels that failed the CLAVR-1 Thermal Uniformity Test (bit 5 of the cloud mask) will be masked. If False, this cloud test will be ignored.

This parameter is ignored for nighttime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

useDayCloudTest6
Python type:bool
Default value:True

If True, daytime pixels that failed the CLAVR-1 Four Minus Five Test (bit 6 of the cloud mask) will be masked. If False, this cloud test will be ignored.

This parameter is ignored for nighttime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

useDayCloudTest7
Python type:bool
Default value:True

If True, daytime pixels that failed the CLAVR-1 Thermal Gross Cloud Test (bit 7 of the cloud mask) will be masked. If False, this cloud test will be ignored.

This parameter is ignored for nighttime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

maskWhenDayCloudMaskExceeds
Python type:int or None
Default value:None
Minimum value:0

If a value is provided, daytime pixels with a cloud mask value greater than this value will be masked.

The CoastWatch cloud mask is a bitmask, where each bit represents the success (0) or failure (1) of a given CLAVR cloud test. Thus the cloud mask values are NOT intended to be interpreted as range, like a spectrum, where 0 represents "very clear" and 255 represents "very cloudy". Nevertheless, some users of this tool determined that for their study the best tradeoff between minimizing SST error and minimizing the number of pixels masked by clouds was obtained by masking all pixels where the cloud mask exceeded a certain value. This option was implemented specifically for those users and is not recommended for general use. If you do use this option, be sure to study many cloud mask images before selecting a value.

If a value is provided both for this parameter and for the cloud test bits specified by the previous parameters, all of these parameters will be effective. In other words, a cloudy pixel can be masked by failing a specific cloud test, or by exceeding the minimum cloud mask value, or both. .

This parameter is ignored for nighttime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter. For more information about the cloud tests, please see the CoastWatch and CLAVR documentation.

useNightCloudTest1
Python type:bool
Default value:True

If True, nighttime pixels that failed the CLAVR-1 Thermal Gross Cloud Test (bit 1 of the cloud mask) will be masked. If False, this cloud test will be ignored.

This parameter is ignored for daytime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

useNightCloudTest2
Python type:bool
Default value:True

If True, nighttime pixels that failed the CLAVR-1 Thermal Uniformity Test (bit 2 of the cloud mask) will be masked. If False, this cloud test will be ignored.

This parameter is ignored for daytime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

useNightCloudTest3
Python type:bool
Default value:True

If True, nighttime pixels that failed the CLAVR-1 Uniform Low Stratus Test (bit 3 of the cloud mask) will be masked. If False, this cloud test will be ignored.

This parameter is ignored for daytime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

useNightCloudTest4
Python type:bool
Default value:True

If True, nighttime pixels that failed the CLAVR-1 Four Minus Five Test (bit 4 of the cloud mask) will be masked. If False, this cloud test will be ignored.

This parameter is ignored for daytime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

useNightCloudTest5
Python type:bool
Default value:True

If True, nighttime pixels that failed the CLAVR-1 Cirrus Test (bit 5 of the cloud mask) will be masked. If False, this cloud test will be ignored.

This parameter is ignored for daytime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

useNightCloudTest6
Python type:bool
Default value:True

If True, nighttime pixels that failed the CLAVR-x Channel 3B Albedo Test (bit 6 of the cloud mask) will be masked. If False, this cloud test will be ignored.

According to CoastWatch researcher Peter Hollemans, this test was not used for CoastWatch CWF files and thus bit 6 will always be 0, indicating success, for CWF nighttime cloud mask pixels.

This parameter is ignored for daytime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

useNightCloudTest7
Python type:bool
Default value:True

If True, nighttime pixels that failed the CLAVR-x Channel 3B Albedo Uniformity Test (bit 7 of the cloud mask) will be masked. If False, this cloud test will be ignored.

According to CoastWatch researcher Peter Hollemans, this test was not used for CoastWatch CWF files and thus bit 7 will always be 0, indicating success, for CWF nighttime cloud mask pixels.

This parameter is ignored for daytime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter.

In CoastWatch cloud masks, bit 1 is the least significant bit, and a value of 0 for a bit indicates that the cloud test passed, while 1 indicates it failed. For more details about the cloud tests, please see the CoastWatch and CLAVR documentation.

maskWhenNightCloudMaskExceeds
Python type:int or None
Default value:None
Minimum value:0

If a value is provided, nighttime pixels with a cloud mask value greater than this value will be masked.

The CoastWatch cloud mask is a bitmask, where each bit represents the success (0) or failure (1) of a given CLAVR cloud test. Thus the cloud mask values are NOT intended to be interpreted as range, like a spectrum, where 0 represents "very clear" and 255 represents "very cloudy". Nevertheless, some users of this tool determined that for their study the best tradeoff between minimizing SST error and minimizing the number of pixels masked by clouds was obtained by masking all pixels where the cloud mask exceeded a certain value. This option was implemented specifically for those users and is not recommended for general use. If you do use this option, be sure to study many cloud mask images before selecting a value.

If a value is provided both for this parameter and for the cloud test bits specified by the previous parameters, all of these parameters will be effective. In other words, a cloudy pixel can be masked by failing a specific cloud test, or by exceeding the minimum cloud mask value, or both. .

This parameter is ignored for daytime pixels. For a discussion of how pixels are classified as daytime or nighttime, please see the documentation for the cloud mask file parameter. For more information about the cloud tests, please see the CoastWatch and CLAVR documentation.

minCloudyNeighbors
Python type:int or None
Default value:None
Minimum value:1

Minimum number of neighbors that a cloudy pixel must have in order for that pixel to be masked.

You can use this option to ignore isolated cloudy pixels that are not clumped together. For example, if you specify the value 1, cloudy pixels will be ignored and not used in the masking process unless at least one of their eight neighbors is also cloudy.

If a neighbor is not cloudy but it is masked for some other reason (e.g. it is land), it does not count as being cloudy.

This option is ignored when cloud masking is not performed.

projectedCoordinateSystem
Python type:unicode or None
Default value:None
Minimum length:1

New coordinate system to project the raster to.

The raster may only be projected to a new coordinate system if the original projection is defined. An error will be raised if you specify a new coordinate system without defining the original coordinate system.

The ArcGIS Project Raster tool is used to perform the projection. The documentation for that tool recommends that you also specify a cell size for the new coordinate system.

I have noticed that for certain coordinate systems the ArcGIS 9.2 Project Raster tool seems to clip the projected raster to an arbitrary extent that is too small. For example, when projecting a global MODIS Aqua 4 km chlorophyll image in geographic coordinates to Lambert_Azimuthal_Equal_Area with central meridian of -60 and latitude of origin of -63, the resulting image is clipped to show only one-quarter of the planet. This problem does not occur when Project Raster is invoked interactively from the ArcGIS user interface; it only occurs when the tool is invoked programmatically (the ProjectRaster_management method of the geoprocessor). Thus you may not see it when you use Project Raster yourself but it may happen when you use MGET tools that invoke Project Raster as part of their geoprocessing operations.

If you encounter this problem, you can work around it like this:

geographicTransformation
Python type:unicode or None
Default value:None
Minimum length:1

A transformation method used to convert between the original coordinate system and the new coordinate system.

This parameter is a new option introduced by ArcGIS 9.2. You must have ArcGIS 9.2 to use this parameter.

This parameter is only needed when you specify that the raster should be projected to a new coordinate system and that new system uses a different datum than the original coordinate system, or there is some other difference between the two coordinate systems that requires a transformation. To determine if a transformation is needed, I recommend the following procedure:

resamplingTechnique
Python type:unicode or None
Default value:None
Allowed values:u'NEAREST', u'BILINEAR', u'CUBIC'

The resampling algorithm to be used to project the original raster to a new coordinate system. The ArcGIS Project Raster tool is used to perform the projection and accepts the following values:

You must specify one of these algorithms to project to a new coordinate system. An error will be raised if you specify a new coordinate system without selecting an algorithm.

projectedCellSize
Python type:float or None
Default value:None

The cell size of the projected coordinate system. Although this parameter is optional, to receive the best results, the ArcGIS documentation recommends you always specify it when projecting to a new coordinate system.

registrationPoint
Python type:unicode or None
Default value:None
Minimum length:1
Must match regular expression:([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)\s+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)

The x and y coordinates (in the output space) used for pixel alignment.

This parameter is a new option introduced by ArcGIS 9.2. You must have ArcGIS 9.2 to use this parameter. It is ignored if you do not specify that the raster should be projected to a new coordinate system.

clippingRectangle
Python type:unicode or None
Default value:None
Minimum length:1
Must match regular expression:([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)\s+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)\s+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)\s+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)

Rectangle to which the raster should be clipped.

If a projected coordinate system was specified, the clipping is performed after the projection and the rectangle's coordinates should be specified in the new coordinate system. If no projected coordinate system was specified, the coordinates should be specified in the original coordinate system.

The ArcGIS Clip tool is used to perfom the clip. The clipping rectangle must be passed to this tool as a string of four numbers separated by spaces. The ArcGIS user interface automatically formats the string properly; when invoking this tool from the ArcGIS UI, you need not worry about the format. But when invoking it programmatically, take care to provide a properly-formatted string. The numbers are ordered LEFT, BOTTOM, RIGHT, TOP. For example, if the raster is in a geographic coordinate system, it may be clipped to 10 W, 15 S, 20 E, and 25 N with the string:

10 15 20 25

Integers or decimal numbers may be provided.

mapAlgebraExpression
Python type:unicode or None
Default value:None
Minimum length:1
Maximum length:4000

Map algebra expression to execute on the raster.

WARNING: The ArcGIS Geoprocessing Model Builder may randomly and silently delete the value of this parameter. This is a bug in ArcGIS. Before running a model that you have saved, open this tool and validate that the parameter value still exists.

The expression is executed after the converted raster is projected and clipped (if those options are specified). Use the case-sensitive string inputRaster to represent the raster that you now want to perform map algebra upon. For example, to convert the raster to an integer raster and add 1 to all of the cells, use this expression:

int(inputRaster) + 1

The string inputRaster is case-sensitive. Prior to executing the map algebra expression, the string is replaced with the path to a temporary raster that represents the raster being generated. The final expression must be less than 4000 characters long or ArcGIS will report an error.

The ArcGIS Single Output Map Algebra tool is used to execute the map algebra expression. You must have a license for the ArcGIS Spatial Analyst extension in order to perform map algebra.

Map algebra syntax can be very picky. Here are some tips that will help you succeed with this tool:

buildPyramids
Python type:bool
Default value:False

If True, pyramids will be built for the raster, which will improve its display speed in the ArcGIS user interface.

overwriteExisting
Python type:bool
Default value:False

If True, the output raster will be overwritten, if it exists. If False, a ValueError will be raised if the output raster exists.