Temperature structure of nongrey planetary atmospheres