def idx_to_zbin(idx):
    """
    Return the z bin corresponding to a particular row or column index, assuming 3 fields per z bin.

    Args:
        idx (int): Field index.

    Returns:
        int: z-bin corresponding to field index, where 1 is the first redshift bin.
    """
    return 1 + idx // 3