Calculates temperature