Skip to contents

Set the pixel function of a VRT stack object

Usage

vrt_set_py_pixelfun(x, pixfun, band_idx)

# S3 method for class 'vrt_block'
vrt_set_py_pixelfun(x, pixfun = vrtility::median_numpy(), band_idx = NULL)

# S3 method for class 'vrt_collection'
vrt_set_py_pixelfun(x, pixfun = vrtility::median_numpy(), band_idx = NULL)

median_numpy()

mean_numpy()

geomean_numpy()

quantile_numpy(q)

mean_db_numpy()

Arguments

x

A vrt_stack object

pixfun

A function that returns the Python code for the pixel function

band_idx

The indices of the bands to set the pixel function for. If NULL, the pixel function is set for all bands.

q

Probability of the quantile to compute. Values must be between 0 and 1 inclusive.

Value

character of the python function

character of the python function

Details

median_numpy is a pixel function that calculates the median of the input arrays, it is injected into the VRT file as a Python function. mean_numpy works in the same way but calculates the mean.`

geomean_numpy is a pixel function that calculates the geometric mean of the input arrays. Use cases of this are at present unclear to me. If you have thoughts or references please let me know.

quantile_numpy is a pixel function that calculates the quantile of the input arrays for a given probability. This could be useful where the median fails to filter cloudy or shadowy images effectively.

mean_db_numpy is a pixel function that calculates the mean of the input arrays and then converts to decibels. This is useful for calculating the mean of radar raw/linear backscatter values, for example.