Skip to content

user facing bit packing routine pseudocode #18

@sdtaylor

Description

@sdtaylor

outlines for functions to reverse unpack_to_array and unpack_to_dict()

def pack_from_dict(flag_dict, product, num_bits):
    """
    Where keys are flag names, values are arrays all the same shape. 
    product is a custom product spec. num_bits should be 8,16, or 32
    """
    
    qa_array = np.empty(shaped like input, dtyp = product[numbits])
    
    for flag in products:
        if 1 bit:
            qa_array[flag_bit] = qa_dict[flag]
    
        if > 1 bit:
            # ie. take an array of possible values 0,1,2,3 and convert to two bits.
            temp_qa_array = unpackbits(qa_dict(flag))
            for ii in bits:
                qa_array[flag_bit] = temp_qa_array[flag_bit] # or something like that

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions