import dascore as dc
from dascore.utils.patch import swap_kwargs_dim_to_axis
= dc.get_example_patch()
patch = {"dim": "time", "dtype": None}
kwargs = swap_kwargs_dim_to_axis(patch, kwargs)
new_kwargs # new_kwarg = {'axis': 1, 'dtype': None}
swap_kwargs_dim_to_axis
swap_kwargs_dim_to_axis(
patch ,
kwargs ,
)
Convert dimension names to axis indices in kwargs.
Parameters
Parameter | Description |
---|---|
patch : Patch | The patch object containing dimension information. |
kwargs : dict | Keyword arguments potentially containing ‘dim’ parameter. |
Returns
dict The kwargs with ‘dim’ converted to ‘axis’ if present.