Apply

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

Создает растровый объект путем применения растровой функции или цепочки функций к одному или нескольким растрам.

Обсуждение

Воспользуйтесь функцией Apply для обработки одного или нескольких растровых наборов растровой функцией или цепочкой функций. Эта функция создаст растровый объект, представляющий собой входной растр или растры, к которым была применена растровая функция.

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

Синтаксис

Apply (in_raster, raster_function, {raster_function_arguments})
ПараметрОписаниеТип данных
in_raster
[in_raster,...]

The input raster dataset or datasets. The input can include the following:

  • A single raster—For raster functions that require one raster input, and the raster function argument name for the raster input is Raster. For example, to apply the NDVI raster function to a raster object, the input would be raster_object.
  • A collection of rasters in a tuple—For raster functions that require two or more raster inputs, and the raster function argument names for the raster inputs are Raster, Raster2, Raster3, etc. For example, to apply the Arithmetic raster function to perform a mathematical operation on two rasters, the input would be (raster_object_1,raster_object_2).
  • An array of rasters in a list—For raster functions that require an array of raster inputs, and the raster function argument name for the inputs is Rasters. For example, to apply the Composite Bands raster function to combine three rasters into a single raster, the input would be [raster_object_1,raster_object_2,raster_object_3].
  • A dictionary with names and rasters—For raster functions that require a set of names raster inputs. For example, to apply the Heat Index raster function to calculate apparent temperature, the input would be ['temperature': raster_object_1,'rh': raster_object_2].

Raster
raster_function

The name of a raster function or the path to a custom raster function (.rft.xml file) to apply to the input.

String
raster_function_arguments

The parameters and values associated with the raster function or function chain. If not specified, and if applicable, default values will be used.

For example, the Tasseled Cap raster function does not require any arguments; the input is a single raster, so there is no need to specify arguments.

The Arithmetic raster function, however, requires 5 input parameters: Raster, Raster2, Operation, Cellsize Type and Extent Type. To use Arithmetic with the Apply function, Raster and Raster2 are defined in the in_raster parameter, and the remaining parameters have default values, so if nothing is specified for those parameters, the default values will be used.

For information about the function arguments for each raster function, see Raster function objects.

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

Выходной набор растровых данных с примененной функцией.