apply_extrema_filter#
- rojak.atmosphere.regions.apply_extrema_filter(target_data, extrema_kind, latitude_dim_name='latitude', longitude_dim_name='longitude', **filter_kwargs)[source]#
Apply a spatial extrema filter to a 3D DataArray.
Applies either a maximum or minimum filter from
scipy.ndimageover the latitude and longitude dimensions of a 3D DataArray, with support for Dask-backed arrays.- Parameters:
target_data (
xarray.DataArray) – A 3D DataArray to apply the filter to. Must contain the specified latitude and longitude dimensions.extrema_kind (
ExtremaKind) – The type of extrema filter to apply, eitherExtremaKind.MAXIMAorExtremaKind.MINIMA.latitude_dim_name (str) – Name of the latitude dimension in
target_data. Defaults to"latitude".longitude_dim_name (str) – Name of the longitude dimension in
target_data. Defaults to"longitude".**filter_kwargs – Additional keyword arguments passed to
scipy.ndimage.maximum_filter()orscipy.ndimage.minimum_filter().
- Returns:
A DataArray of the same shape and dtype as
target_datawith the extrema filter applied over the latitude and longitude dimensions.- Return type:
- Raises:
ValueError – If
target_datais not 3D.ValueError – If
target_datadoes not contain the specified latitude and longitude dimensions.