def hash_function(seed, tract, patch, band):
    """Generate a hash key given the base seed and metadata
    """
    band_map = {"u": 1, "g": 2, "r": 3, "i": 4, "z": 5, "y": 6}
    # Add a linear combination of metadata weighted by prime numbers
    hash_key = seed + 131071*tract + 524287*patch + 8388607*band_map[band]
    return hash_key