SubsetBands

Краткая информация

Создает растровый объект, являющийся частью (поднабором) многомерного или гиперспектрального растра, в основе которого лежит выбранный поднабор каналов. На выходе сохраняется тот же порядок каналов, что и на входе.

Обсуждение

Указанный набор растровых данных является временным для растрового объекта. Чтобы сделать его постоянным, вы можете вызвать метод растрового объекта save.

Более подробную информацию о том, как работает эта функция, см. в растровой функции Каналы поднабора.

Синтаксис

SubsetBands (raster, {method}, {bands}, {missing_band_action}, {exclude_bad_bands})
ПараметрОписаниеТип данных
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.

  • BY_NAMES—Band names will be used to identify and create the subset of bands for extraction.
  • BY_WAVELENGTHS—Band wavelengths on the electromagnetic spectrum will be used to identify and create the subset of bands for extraction.
  • BY_IDS—The band designation or sequence number will be used to identify and create the subset of bands for extraction.

(Значение по умолчанию — BY_IDS)

String
bands

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

  • Using the BY_NAMES option for the method argument, specify 'band_15 band_13 band_14'.
  • Using the BY_WAVELENGTHS option for the method argument, specify '400-700 900'.
  • 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.

The bands argument is used to specify the bands to extract 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 extract 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 extracted.

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

Subsets using the BY_NAMES option must be a list of individual names delimited by a space, such as band_1 band_2 band_3. Range is not supported for the BY_NAMES option.

(Значение по умолчанию — None)

String
missing_band_action

Specifies the action that will occur when a band from the bands argument value is not available.

  • BestMatch—The best available band in place of the missing band based on wavelength will be used.
  • Fail—If the input dataset is missing any band specified in the bands argument, the function will fail.

(Значение по умолчанию — BestMatch)

String
exclude_bad_bands

Specifies whether bands that have been flagged as bad will be excluded.

  • True—Bad bands will be excluded.
  • False—Bad bands will not be excluded.

(Значение по умолчанию — False)

Boolean
Возвращаемое значение
Тип данныхОписание
Raster

Выходной растр.

Пример кода

SubsetBands, пример 1

В этом примере каналы извлекаются из входного растра с помощью опции BY_IDS.

extracted_bands = arcpy.ia.SubsetBands(raster=img_lyr, method="BY_IDS", bands="100 105 110 120-130")
SubsetBands, пример 2

В этом примере каналы извлекаются из входного растра с помощью опции BY_NAMES.

extracted_bands = arcpy.ia.SubsetBands(raster=img_lyr, method="BY_NAMES", bands="band_15 band_13 band_14")
SubsetBands, пример 3

В этом примере каналы извлекаются из входного растра с помощью опции BY_WAVELENGTHS.

extracted_bands = arcpy.ia.SubsetBands(raster=img_lyr, method="BY_WAVELENGTHS", bands="400-700 900")