Ecological factors such as temperature, soil, rainfall, sun, and pests shape the chemical compounds in food. And, as the climate changes, so do ecological conditions.