wrf.decorators.cast_type¶
-
wrf.decorators.cast_type(ref_idx=0, arg_idxs=None, karg_names=None, alg_dtype=<Mock id='4361001552'>, outviews=u'outview')¶ A decorator to handle type casting.
This decorator is used to cast variables to and from the required
numpy.dtypeused in the wrapped function.Parameters: - ref_idx (
int, optional) – The index in the wrapped function’s positional arguments to be used as the reference variable for determining thenumpy.dtypeto return. Default is 0. - arg_idxs (sequence of
int, optional) – A sequence of indexes in the wrapped function’s positional arguments that indicate which arguments to cast. Must be specified if karg_names is None. Default is None. - karg_names (sequence of
str) – A sequence of keyword arguments in the wrapped function’s keyword arguments that indicate the arguments to cast. Must be specified if arg_idxs is None. Default is None. - alg_dtype (
numpy.dtypeorstr) – The numpy data type used in the wrapped function. - outviews (
stror a sequence) – A single key or sequence of keys that indicate the wrapped function’s keyword argument to use as the output variable(s) in the wrapped function.
Returns: The wrapped function’s output cast to the same
numpy.dtypeas the reference variable.Return type: - ref_idx (