Winds indicate the restlessness of the Earth’s atmosphere: Air moves about chaotically near the ground, responding to differences in heating and atmospheric pressure, while distinct prevailing high-level winds transfer weather systems around the globe. Despite the large scale of these movements of air, and the confusing pattern they weave to a human observer at the brink, say, of a big storm, the triggers of wind direction are relatively straightforward.
One of the prime drivers of wind direction is atmospheric pressure, essentially the weight at a given point of the overlying column of air. Low pressure is often caused by solar heating, as warmer air ascends; cooled, descending air creates an area of high pressure. Winds flow generally from high to low pressure, essentially to replace the “loss” of air in the latter situation. In addition to helping drive prevailing winds, heat and pressure differences cause variations in local wind direction. For example, “sea breezes” and “land breezes” form because of the differential heating of land masses and large water bodies. During the day, the land surface absorbs heat more rapidly than the water surface and heats the overlying air, which rises; at the height of this, usually in the afternoon, winds travel from the higher-pressure water body inland. At night, the opposite happens--the air over the water retains more heat than the fast-cooling land--and a “land breeze” heads sea- or lakeward.
Winds, though, are partly shunted off direct courses between high and low pressure by the rotation of the Earth. This discrepancy of direction is called the Coriolis effect. The planet rotates from west to east (hence the “rising” of the sun in the east and its “setting” in the west). In the Northern Hemisphere, the Coriolis effect causes out-rushing winds from a high-pressure cell--the anticyclone--to blow in clockwise fashion, while in-rushing winds spiral counterclockwise around the low-pressure cyclone.
At the surface of the Earth, topographic variations may affect wind direction. This factor doesn’t operate exclusively of pressure influences. For example, in mountainous regions winds will switch from blowing up- and downslope depending on the time of day. This has to do with differential heating, pressure and air-parcel weights: At night, heavy cold air rolls down into the valley bottoms; during the day, heating of surrounding slopes draws winds out of the bottoms.