def __init__(self, prod):
        """Initialize the values and labels from the product."""
        self.labels = []
        self.lut = []
        for t in prod.thresholds:
            codes, val = t >> 8, t & 0xFF
            label = ''
            if codes >> 7:
                label = self.lut_names[val]
                if label in ('Blank', 'TH', 'ND'):
                    val = self.MISSING
                elif label == 'RF':
                    val = self.RANGE_FOLD

            elif codes >> 6:
                val *= 0.01
                label = '{:.2f}'.format(val)
            elif codes >> 5:
                val *= 0.05
                label = '{:.2f}'.format(val)
            elif codes >> 4:
                val *= 0.1
                label = '{:.1f}'.format(val)

            if codes & 0x1:
                val *= -1
                label = '-' + label
            elif (codes >> 1) & 0x1:
                label = '+' + label

            if (codes >> 2) & 0x1:
                label = '<' + label
            elif (codes >> 3) & 0x1:
                label = '>' + label

            if not label:
                label = str(val)

            self.lut.append(val)
            self.labels.append(label)
        self.lut = np.array(self.lut)
def __init__ ( self , prod ) : self . labels = [ ] self . lut = [ ] for t in prod . thresholds : codes , val = t >> 8 , t & 0xFF label = '' if codes >> 7 : label = self . lut_names [ val ] if label in ( 'Blank' , 'TH' , 'ND' ) : val = self . MISSING elif label == 'RF' : val = self . RANGE_FOLD elif codes >> 6 : val *= 0.01 label = '{:.2f}' . format ( val ) elif codes >> 5 : val *= 0.05 label = '{:.2f}' . format ( val ) elif codes >> 4 : val *= 0.1 label = '{:.1f}' . format ( val ) if codes & 0x1 : val *= - 1 label = '-' + label elif ( codes >> 1 ) & 0x1 : label = '+' + label if ( codes >> 2 ) & 0x1 : label = '<' + label elif ( codes >> 3 ) & 0x1 : label = '>' + label if not label : label = str ( val ) self . lut . append ( val ) self . labels . append ( label ) self . lut = np . array ( self . lut )
Initialize the values and labels from the product.