CSX (CSX 1.07%) will kick off earnings season for North America's Class I railroad stocks on Oct. 15, followed up by Union Pacific's (UNP 4.99%) report on Oct. 17 -- and all eyes will be on coal.

Source: Union Pacific.

Coal is the most important commodity to the U.S. railroad industry, but U.S. coal production has fallen to its lowest level in 20 years. Shrinking volumes have hurt the bottom line for the big railroads, sending them scrambling to diversify their businesses beyond coal. As is so often the case in rail, the geography of the railroad companies' tracks will have a big impact in determining who will win and who will lose as King Coal loses power.

Coal reached its peak in 2008, but it still made up more than 40% of tonnage and more than 20% of revenue in 2012. The predominant use for coal stock shipped by rail is for electricity generation at coal-burning power plants. In recent years, however, coal power has been squeezed. Rock-bottom natural gas prices have made coal a less economically competitive power source, while environmental regulations have upped compliance costs for coal plants and made the prospect of new coal-fired plants unlikely. As a result, Class I railroads' coal shipments have fallen 18% by tonnage since 2008. They're likely to fall lower still.

That's not all bad news. While coal is big business for railroads, it's not very profitable. Measured by revenue per ton-mile, a metric that takes both weight and distance into account, coal is by far the least lucrative commodity that railroads ship, bringing in an average of just 2.88 cents per ton-mile in 2011, compared with a commodity average of 5.78 cents, more than double coal. Moving coal is certainly high-volume for the railroad stocks, but it's not high-margin.

All of this means there's a carrot and a stick for railroads to move aggressively away from coal. Not only is it more profitable to have cars moving virtually anything other than coal, but there's also the simple fact that coal is going away and isn't coming back. That means the rail companies that can pivot away from coal fastest will perform the best, rewarding stockholders along the way. Some rail companies are performing better in this area than others.

CSX, which has most of its trackage in the Eastern United States and is therefore heavily exposed to Appalachian coal shipments, was downgraded on Friday by Citigroup, on concerns that coal volumes would be even lower than expected. While I'm not usually one to lend credence to big bank upgrades or downgrades, CSX is particularly vulnerable to coal shipments, which accounted for more than 30% of revenue in 2011, declining to 27% in 2012. Railroads highly exposed to Appalachian coal, such as CSX and Norfolk Southern (NSC 1.95%), which derived more than a quarter of revenue from coal in 2012, will find it most difficult to rebuild their businesses in a world of terminally declining coal.

Union Pacific saw its stock sink last week after management lowered guidance for its third quarter, based in large part on lower coal volumes. Coal accounted for 22% of Union Pacific's revenue in 2011. With that level of coal exposure, Union Pacific won't get off easy from the terminal decline in coal, but the railroad has more time than most. The coal Union Pacific hauls is primarily from the Wyoming Powder River Basin, a deposit that yields a lower-sulphur, cleaner coal that is more able to meet environmental regulations. It's worth saying that in 2012, Union Pacific's lower coal volumes were not primarily due to the general decline in coal, but due to floods in Colorado that affected its operations. With significant trackage in the western U.S. prepared to accept intermodal traffic from China and handle byproducts of fracking in the Mountain West, Union Pacific is better situated to deal with declining coal volumes than its eastern counterparts are.

The railroads most able to weather the decline of coal are those with low coal exposure and plenty of opportunities in other businesses such as intermodal, oil-by-rail, and timber. Chief among these geographically privileged railroads, with the highest margins in the business, is Canadian National (CNI 1.56%). With a uniquely comprehensive track geography that hits the Pacific, the Atlantic, and the Gulf of Mexico, Canadian National derives the lion's share of its revenue from such evergreen shipments as intermodal containers, agricultural products, and chemicals, with only 7% of revenue coming from coal, the lowest in the business.

The rail industry is changing, and as it confronts lower coal volumes, investors should strongly consider the companies best positioned to adjust to that decline. To that end, Canadian National is a name every investor should keep in mind when weighing their options in this industry.