dctools.utilities.format_converter.group_format2_by_metric

dctools.utilities.format_converter.group_format2_by_metric(format2_results)

Group Format2 results by metric.

Parameters:

format2_results (List[Dict[str, Union[str, float]]]) – Format2 Results

Returns:

Results grouped by metric

Return type:

Dict[str, List[Dict[str, Union[str, float]]]]

Example

>>> format2 = [
...     {'Metric': 'rmse', 'Variable': 'Surface salinity', 'Value': 0.78},
...     {'Metric': 'mae', 'Variable': 'Surface salinity', 'Value': 0.65},
...     {'Metric': 'rmse', 'Variable': '50m salinity', 'Value': 0.365}
... ]
>>> group_format2_by_metric(format2)
{
    'rmse': [
        {'Metric': 'rmse', 'Variable': 'Surface salinity', 'Value': 0.78},
        {'Metric': 'rmse', 'Variable': '50m salinity', 'Value': 0.365}
    ],
    'mae': [
        {'Metric': 'mae', 'Variable': 'Surface salinity', 'Value': 0.65}
    ]
}