resample¶
- earthkit.transforms.resample(dataarray: Dataset | DataArray, frequency: str | int | float, time_dim: str = 'time', how: str = 'mean', skipna: bool = True, how_args: list[Any] | None = None, how_kwargs: dict[str, Any] | None = None, how_label: str | None = None, extra_reduce_dims: str | list[str] | None = None, **kwargs) Dataset | DataArray[source]¶
Resample dataarray to a user-defined frequency using a user-defined “how” method.
- Parameters:
dataarray (xarray.DataArray or xarray.Dataset) – Data object to be resampled.
frequency (str, int, float) – The frequency at which to resample the chosen dimension. The format must be applicable to the chosen dimension.
time_dim (str) – The dimension to resample along, default is time
how (str) – The reduction method for resampling, default is mean
how_label (str) – Label to append to the name of the variable in the reduced object, default is nothing
skipna (bool) – If True, exclude missing values (na values) from the reduction.
how_args (list) – List of arguments to be passed to the reduction method.
how_kwargs (dict) – Dictionary of keyword arguments to be passed to the reduction method.
extra_reduce_dims (str or list of str, optional) – Extra dimensions to reduce over in addition to the resampling dimension. These dimensions will be reduced over using the same how method as the resampling dimension. Default is None (no extra dimensions).
**kwargs – Keyword arguments to be passed to
resample(). Defaults have been set as: {“skipna”: True}
- Return type: