When the cold air comes in contact with the warm ground the heat energy from ground is transferred to the air because heat transfer from a hot body to a cold body. Now, the warm air rises up and cold air comes down which again gain heat energy from ground and gets warm.