import math


def siteXYZ(sites):
    """
    computes geocentric site coordinates from parallax constants.

    Parameters
    ----------
    sites : dictionary
        Typically the value returned from read5c.  Keys are obscodes and values
        must have attributes blank, rcos, rsin, and long.

    Returns
    -------
    dictionary
        Keys are the keys of the sites parameter, values are 3-tuples floats,
        the geocentric coordinates, where blank = False and the 3-tuple
        (None, None, None) where blank = True.
    """
    ObservatoryXYZ = {}
    for code, s in sites.items():
        if not s.blank:
            longitude = s.long * math.pi / 180
            x = s.rcos * math.cos(longitude)
            y = s.rcos * math.sin(longitude)
            z = s.rsin
            ObservatoryXYZ[code] = (x, y, z)
        else:
            ObservatoryXYZ[code] = (None, None, None)
    return ObservatoryXYZ