healpix_convolution.pad#
- healpix_convolution.pad(cell_ids, *, grid_info, ring, mode='constant', constant_value=0, end_value=0, reflect_type='even')#
pad an array
- Parameters:
cell_ids (array-like) – The cell ids.
grid_info (
xdggs.DGGSInfo) – The grid parameters.ring (
int) – The pad width in rings around the input domain. Must be 0 or positive.mode (
str, default:"constant") – The padding mode. Can be one of:“constant”: fill the padded cells with
constant_value.“linear_ramp”: linearly interpolate the padded cells from the edge of the array to
end_value. For ring 1, this is the same asmode="constant"“edge”: fill the padded cells with the values at the edge of the array.
“reflect”: pad with the reflected values.
“mean”: pad with the mean of the neighbours.
“minimum”: pad with the minimum of the neighbours.
“maximum”: pad with the maximum of the neighbours.
constant_value (scalar, default:
0) – The constant value used in constant mode.end_value (scalar, default:
0) – The othermost value to interpolate to. Only used in linear ramp mode.reflect_type (
{"even", "odd"}, default:"even") – The reflect type. Only used in reflect mode.initial (scalar, default:
0) – The identity to use in maximum / minimum mode.
- Returns:
padding_object (
healpix_convolution.Padding) – The padding object. Can be used to apply the same padding operation for different arrays with the same geometry.
Warning
This assumes
cell_idsis sorted, and will give wrong results if it is not.