wrf.combine_dims¶
- class wrf.combine_dims(pairs)¶
A callable class that mixes dimension sizes from different function arguments.
This callable object is used for determining the output size for the extension module functions. The class is initialized with a sequence of pairs, where the first value is the function argument index. The second value is the dimension index(es) to use. The second value can be a single integer or a sequence if multiple dimensions are used.
- __call__(*args)¶
Return a tuple with the combined dimension sizes.
- Parameters:
*args – The function arguments from which to extract the dimensions sizes.
- Returns:
The shape for the combined dimensions.
- Return type:
- pairs¶
A sequence representing how to combine the dimensions.
- Type:
sequence
Example
# Take the -3, and -2 dimension sizes from argument 0 # Then take the -1 dimension size from argument 1 pairs = [(0, (-3, -2), (1, -1)] combo = combine_dims(pairs)
- __init__(pairs)¶
Initialize a
combine_dims
object.- Parameters:
pairs (sequence) – A sequence where each element is a pair (
tuple
), with the first element being the function argument index and the second value being either an integer or sequence for the dimension size indexes to use.
Methods
__init__
(pairs)Initialize a
combine_dims
object.