(A, B)
return Lookup(A.variable, lookup_table)
Merge two consecutive Lookup transforms into one.
Merge two consecutive Lookup transforms into one.
Merge two consecutive Lookup transforms into one .
def merge_lookup(A, B):
    """
    Merge two consecutive Lookup transforms into one.
    """
    lookup_table = np.array(A.lookup_table)
    mask = np.isfinite(lookup_table)
    indices = np.array(lookup_table[mask], dtype=int)
    lookup_table[mask] = B.lookup_table[indices]
    return Lookup(A.variable, lookup_table)
def merge_lookup ( A , B ) : lookup_table = np . array ( A . lookup_table ) mask = np . isfinite ( lookup_table ) indices = np . array ( lookup_table [ mask ] , dtype = int ) lookup_table [ mask ] = B . lookup_table [ indices ] return Lookup ( A . variable , lookup_table )