left_iteration(ref_var_expected_dims, ref_var_right_ndims, insert_dims=None, ref_var_idx=None, ref_var_name=None, ignore_args=None, ignore_kargs=None, outviews='outview', alg_dtype=<MagicMock id='139965807575616'>, cast_output=True)¶
A decorator to handle iterating over the leftmost dimensions.
For example, if a wrapped function works with three-dimensional arrays, but the variables include a 4th leftmost dimension for ‘Time’, this decorator will iterate over all times, call the 3D Fortran routine, and aggregate the results in to a 4D output array.
It is also important to note that the final output array is allocated first, and then views are passed to the wrapped function so that values do not need to get copied in to the final output array.
- ref_var_expected_dims (
int) – The number of dimensions that the Fortran routine is expecting for the reference variable.
- ref_var_right_ndims (
int) – The number of dimensions from the right to keep for the reference variable when making the output. Can also be a
combine_dimsobject if the sizes are determined from multiple variables.
- insert_dims (sequence of
int, optional) – A sequence of dimensions to insert between the left dimensions (e.g. time) and the kept right dimensions. Default is None.
- ref_var_idx (
int, optional) – The index in the wrapped function’s positional arguments to be used as the reference variable for determining the leftmost dimensions. Must be specified if ref_var_name is None. Default is None.
- ref_var_name (
str, optional) – The keyword argument name for the wrapped function’s keyword arguments to be used as the reference variable for calculating the leftmost dimensions. Must be specified if ref_var_idx is None. Default is None.
- ignore_args (sequence of
int) – Indexes of any arguments that should be ignored when creating the sliced views that are passed to the Fortran routine.
- ignore_kargs (sequence of
str) – Keys of any keyword arguments that should be ignored when creating the sliced views that are passed to the Fortran routine.
- 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.
- alg_dtype (
str) – The numpy data type used in the wrapped function.
- cast_output (
bool) – Set to True to cast the wrapped function’s output to the same type as the reference variable.
The aggregated output array that includes all extra leftmost dimensions found in the reference variable.
- ref_var_expected_dims (