Pad this array along one or more dimensions. .. warning:: This function is experimental and its behaviour is likely to change especially regarding padding of dimension coordinates (or IndexVariables). When using one of the modes ("edge", "reflect", "symmetri
(
self,
pad_width: Mapping[Any, int | tuple[int, int]] | None = None,
mode: PadModeOptions = "constant",
stat_length: (
int | tuple[int, int] | Mapping[Any, tuple[int, int]] | None
) = None,
constant_values: (
float | tuple[float, float] | Mapping[Any, tuple[float, float]] | None
) = None,
end_values: int | tuple[int, int] | Mapping[Any, tuple[int, int]] | None = None,
reflect_type: PadReflectOptions = None,
keep_attrs: bool | None = None,
**pad_width_kwargs: Any,
)
| 5841 | ) |
| 5842 | |
| 5843 | def pad( |
| 5844 | self, |
| 5845 | pad_width: Mapping[Any, int | tuple[int, int]] | None = None, |
| 5846 | mode: PadModeOptions = "constant", |
| 5847 | stat_length: ( |
| 5848 | int | tuple[int, int] | Mapping[Any, tuple[int, int]] | None |
| 5849 | ) = None, |
| 5850 | constant_values: ( |
| 5851 | float | tuple[float, float] | Mapping[Any, tuple[float, float]] | None |
| 5852 | ) = None, |
| 5853 | end_values: int | tuple[int, int] | Mapping[Any, tuple[int, int]] | None = None, |
| 5854 | reflect_type: PadReflectOptions = None, |
| 5855 | keep_attrs: bool | None = None, |
| 5856 | **pad_width_kwargs: Any, |
| 5857 | ) -> Self: |
| 5858 | """Pad this array along one or more dimensions. |
| 5859 | |
| 5860 | .. warning:: |
| 5861 | This function is experimental and its behaviour is likely to change |
| 5862 | especially regarding padding of dimension coordinates (or IndexVariables). |
| 5863 | |
| 5864 | When using one of the modes ("edge", "reflect", "symmetric", "wrap"), |
| 5865 | coordinates will be padded with the same mode, otherwise coordinates |
| 5866 | are padded using the "constant" mode with fill_value dtypes.NA. |
| 5867 | |
| 5868 | Parameters |
| 5869 | ---------- |
| 5870 | pad_width : mapping of Hashable to tuple of int |
| 5871 | Mapping with the form of {dim: (pad_before, pad_after)} |
| 5872 | describing the number of values padded along each dimension. |
| 5873 | {dim: pad} is a shortcut for pad_before = pad_after = pad |
| 5874 | mode : {"constant", "edge", "linear_ramp", "maximum", "mean", "median", \ |
| 5875 | "minimum", "reflect", "symmetric", "wrap"}, default: "constant" |
| 5876 | How to pad the DataArray (taken from numpy docs): |
| 5877 | |
| 5878 | - "constant": Pads with a constant value. |
| 5879 | - "edge": Pads with the edge values of array. |
| 5880 | - "linear_ramp": Pads with the linear ramp between end_value and the |
| 5881 | array edge value. |
| 5882 | - "maximum": Pads with the maximum value of all or part of the |
| 5883 | vector along each axis. |
| 5884 | - "mean": Pads with the mean value of all or part of the |
| 5885 | vector along each axis. |
| 5886 | - "median": Pads with the median value of all or part of the |
| 5887 | vector along each axis. |
| 5888 | - "minimum": Pads with the minimum value of all or part of the |
| 5889 | vector along each axis. |
| 5890 | - "reflect": Pads with the reflection of the vector mirrored on |
| 5891 | the first and last values of the vector along each axis. |
| 5892 | - "symmetric": Pads with the reflection of the vector mirrored |
| 5893 | along the edge of the array. |
| 5894 | - "wrap": Pads with the wrap of the vector along the axis. |
| 5895 | The first values are used to pad the end and the |
| 5896 | end values are used to pad the beginning. |
| 5897 | |
| 5898 | stat_length : int, tuple or mapping of Hashable to tuple, default: None |
| 5899 | Used in 'maximum', 'mean', 'median', and 'minimum'. Number of |
| 5900 | values at edge of each axis used to calculate the statistic value. |