format_handler¶
- earthkit.utils.decorators.format_handler(kwarg_types: Dict[str, Any] = {}, convert_types: None | Tuple[Any] | Dict[str, Tuple[Any]] = None) Callable[source]¶
Transform the inputs to a function to match the requirements.
- Parameters:
kwarg_types (Dict[str, type]) – Mapping of accepted object types for each arg/kwarg, this is to provide kwarg types in the case of an untyped function, or to override the function signature.
convert_types (Tuple[type] or Dict[str, Tuple[type]]) – Data types to try to convert, in cases where the function is flexible and can handle multiple types which are not specified by the type-setting. For example, numpy functions can often handle numpy, pandas and xarray data objects. If a dict, applies per-argument.
- Returns:
Wrapped function.
- Return type:
Callable