@@ -1017,7 +1017,7 @@ def gridpoints_core_calc(
10171017
10181018 Returns
10191019 -------
1020- result : np.array of same shape as arrays in data_arrays
1020+ np.array of same shape as arrays in data_arrays
10211021 Results from calculation described above.
10221022 """
10231023 # Convert input data to arrays
@@ -1048,17 +1048,18 @@ def prepare_input(input_data, default_value, name):
10481048 exponents = prepare_input (exponents , 1 , "exponents" )
10491049
10501050 # Steps 1-3: arrays are multiplied after application of offets and exponents:
1051- data = data .T # Transpose so that broadcasting over last dimension works
1052- data = (data + offsets ) ** exponents
1053- result = data .prod (axis = - 1 ).T # Transpose back
1051+ # NOTE: Transpose so that broadcasting over last dimension works. Computing the
1052+ # product over the last axis is also much faster. Then transpose back.
1053+ data = (data .T + offsets ) ** exponents
1054+ data = data .prod (axis = - 1 ).T
10541055
10551056 # Steps 4+5: if total value for rescaling is provided, result is normalized and
10561057 # scaled with this total value (total_val_rescale):
10571058 if isinstance (total_val_rescale , (float , int )):
1058- return result / result .sum () * total_val_rescale
1059+ return data / data .sum () * total_val_rescale
10591060 if total_val_rescale is not None :
10601061 raise TypeError ("total_val_rescale must be int or float." )
1061- return result
1062+ return data
10621063
10631064
10641065# The following functions are only required if calc_admin1 is True,
0 commit comments