LabelBadBands

Summary

Creates a raster object that labels bad bands in a multidimensional or hyperspectral raster based on a selected subset of bands. The output maintains the same band order as the input.

Discussion

This function allows you to specify a set of bands using ranges or lists to be labeled as bad. The output will have the band property IsBadBand set to 1. The property will be created if it does not already exist. This function supports both multispectral and hyperspectral images, and maintains the same band order as input.

The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.

For more information about how this function works, see the Label Bad Bands raster function.

Syntax

LabelBadBands (raster, {method}, {bands})
ParameterExplanationData Type
raster

The input multidimensional or hyperspectral image.

Raster
method

Specifies the method that will be used to label bad bands in the input image.

  • BY_IDS—The band designation or sequence number will be used to label bad bands in the input image.
  • BY_WAVELENGTHS—Band wavelengths on the electromagnetic spectrum will be used to label bad bands in the input image.

(The default value is BY_IDS)

String
bands

The bands that will be labeled as bad bands based on the specified method argument option. The following are examples:

  • Using the BY_IDS option for the method argument, specify '100 105 110 120-130'. Values will be minus by 1 for a 0-based index.
  • Using the BY_WAVELENGTHS option for the method argument, specify '400-480 900'.

The bands argument specifies the bands that will be labeled as bad bands and depends on the method option specified. The bands are entered as a space-delimited list and can be specified as ranges of bands. For example, when specifying a subset using the BY_IDS option for the method parameter, a value of 20-50 60-100 200 will label band IDs between (inclusive) 20 and 50, 60 and 100, and a band with an ID of 200.

When specifying the bands parameter value using the BY_WAVELENGTHS option for the method argument, all bands within the wavelength range will be labeled.

When specifying bands by wavelength, the units—such as microns or nanometers—will be the same as the input units.

(The default value is None)

String
Return Value
Data TypeExplanation
Raster

The output image with bad bands labeled.

Code sample

LabelBadBands example 1

This example extracts the bands from the input raster using the BY_IDS option.

labeled_bands = arcpy.ia.LabelBadBands(raster=img_lyr, method="BY_IDS", bands="100 105 110 120-130")
LabelBadBands example 2

This example extracts the bands from the input raster using the BY_WAVELENGTH option.

labeled_bands = arcpy.ia.LabelBadBands(raster=img_lyr, method="BY_WAVELENGTHS", bands="400-700")