Example #1
0
    def colour_code_by_wh_absolute(self, t):
        """Colour-code HP list by WH absolute, WH range is [0,10].

        t  list of tuples (id, lon, lat, wh)

        Return list of tuples as above but with 'wh' replaced by a colour
        string of the form #RRGGBB with each two chars a hex value. For
        example, '#00FF00' would be green.

        Colour-coding is performed over the absolute range 0 <-> 10.0.
        """

        return [(id, lon, lat, dep, util.colour_code_val(0, wh, 10.0))
                for (id, lon, lat, dep, wh) in t]
Example #2
0
    def colour_code_by_wh_range(self, t):
        """Colour-code HP list by WH over data range.

        t  list of tuples (id, lon, lat, wh)

        Return list of tuples as above but with 'wh' replaced by a colour
        string of the form #RRGGBB with each two chars a hex value. For
        example, '#00FF00' would be green.

        Colour-coding is performed over the data range min <-> max.
        """

        min_val = min([wh for (_, _, _, _, wh) in t])
        max_val = max([wh for (_, _, _, _, wh) in t])

        return [(id, lon, lat, dep, util.colour_code_val(min_val, wh, max_val))
                for (id, lon, lat, dep, wh) in t]