@staticmethod
    def normalize_series_by_unit(series):
        if not series:
            return series

        source_unit = target_unit = series[0]['unit']

        if not units.is_supported(source_unit):
            return series

        # Find the data point with the largest value and normalize it to
        # determine its unit - that will be the new unit
        maximum = max([d['y'] for point in series for d in point['data']])
        unit = units.normalize(maximum, source_unit)[1]

        # If unit needs to be changed, set the new unit for all data points
        # and convert all values to that unit
        if units.is_larger(unit, target_unit):
            target_unit = unit
            for i, point in enumerate(series[:]):
                if point['unit'] != target_unit:
                    series[i]['unit'] = target_unit
                    for j, d in enumerate(point['data'][:]):
                        series[i]['data'][j]['y'] = units.convert(
                            d['y'], source_unit, target_unit, fmt=True)[0]

        return series
Return number of disk (reads, writes).
dataset/ETHPy150Open CiscoSystems/avos/openstack_dashboard/dashboards/admin/metering/views.py/SamplesView.normalize_series_by_unit--crossover with--dataset/ETHPy150Open cgoldberg/linux-metrics/linux_metrics/disk_stat.py/disk_reads_writes