SubsetBands
Summary
Creates a raster object that is a subset of a multidimensional or hyperspectral raster based on a selected subset of bands. The output maintains the same band order as the input.
Discussion
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 Subset Bands raster function.
Syntax
SubsetBands(raster, {method}, {bands}, {missing_band_action}, {exclude_bad_bands})
| Parameter | Explanation | Data Type |
|---|---|---|
|
raster |
The input hyperspectral or multidimensional raster. |
Raster |
|
method |
Specifies the method that will be used to extract and create the subset of the bands.
The default value is BY_IDS. |
String |
|
bands |
The bands that will be extracted based on the specified
The When specifying the When specifying bands by wavelength, the units—such as microns or nanometers—are the same as the input units. Subsets using the The default value is None. |
String |
|
missing_band_action |
Specifies the action that will occur when a band from the
The default value is BestMatch. |
String |
|
exclude_bad_bands |
Specifies whether bands that have been flagged as bad will be excluded.
The default value is False. |
Boolean |
Return value
| Data Type | Explanation |
|---|---|
|
Raster |
The output subset raster. |
Code sample
This example extracts the bands from the input raster using the BY_IDS option.
extracted_bands = arcpy.ia.SubsetBands(raster=img_lyr, method="BY_IDS", bands="100 105 110 120-130")
This example extracts the bands from the input raster using the BY_NAMES option.
extracted_bands = arcpy.ia.SubsetBands(raster=img_lyr, method="BY_NAMES", bands="band_15 band_13 band_14")
This example extracts the bands from the input raster using the BY_WAVELENGTHS option.
extracted_bands = arcpy.ia.SubsetBands(raster=img_lyr, method="BY_WAVELENGTHS", bands="400-700 900")