def compress_dinf(angle, nodata):
        """Compress dinf flow direction to D8 direction with weight follows ArcGIS D8 codes.
        Args:
            angle: D-inf flow direction angle
            nodata: NoData value

        Returns:
            1. Updated Dinf values
            2. Compressed flow direction follows ArcGIS D8 codes rule
            3. Weight of the first direction
        """
        if MathClass.floatequal(angle, nodata):
            return DEFAULT_NODATA, DEFAULT_NODATA, DEFAULT_NODATA
        taud, d = DinfUtil.check_orthogonal(angle)
        if d != -1:
            return taud, d, 1
        if angle < FlowModelConst.ne:
            a1 = angle
            d = 129  # 1+128
        elif angle < FlowModelConst.n:
            a1 = angle - FlowModelConst.ne
            d = 192  # 128+64
        elif angle < FlowModelConst.nw:
            a1 = angle - FlowModelConst.n
            d = 96  # 64+32
        elif angle < FlowModelConst.w:
            a1 = angle - FlowModelConst.nw
            d = 48  # 32+16
        elif angle < FlowModelConst.sw:
            a1 = angle - FlowModelConst.w
            d = 24  # 16+8
        elif angle < FlowModelConst.s:
            a1 = angle - FlowModelConst.sw
            d = 12  # 8+4
        elif angle < FlowModelConst.se:
            a1 = angle - FlowModelConst.s
            d = 6  # 4+2
        else:
            a1 = angle - FlowModelConst.se
            d = 3  # 2+1
        return angle, d, a1 / PI * 4.0