Millions around the world wake up and brew a cup of coffee before they start their day. But for many involved in the industry, a caffeine buzz isn't keeping them up at night—instead, what's causing insomnia is the increasing difficulty that climate change causes coffee farmers.

Coffee is one of the world's most traded commodities. Each year, more than $15 billion worth of coffee is exported from 52 countries—many of which are still developing and rely on the crop to buoy their economies. The industry employs some 26 million people worldwide.

But in recent years, keeping the world's coffee drinkers supplied has become increasingly difficult: The spread of a deadly fungus that has been linked to global warming and rising global temperatures in the tropical countries where coffee grows has researchers scrambling to create new varieties of coffee plants that can keep pace with these new threats without reducing quality.

While coffee researchers can do little to prevent climate change, they're hard at work to keep up as Earth braces for temperature increases of several degrees over the next several decades.

"Coffee is the canary in the coal mine for climate change," says Ric Rhinehart, executive director of the Specialty Coffee Association of America. "If you can't think about the long term risk for planetary impacts, think about the short term risk for your coffee. Know that a day without coffee is potentially around the corner."

The problem has gotten so bad that on March 18, Starbucks bought its first ever coffee farm, specifically to research new climate change-resistant coffee varieties.

"The threats climate change pose isn't a surprise to us," says Haley Drage, representative for the company. "We've been working on this for more than 10 years and it's something we continue to work with farmers on."

For most coffee drinkers, there's no finer bean than Arabica, a variety that originated in Ethiopia and has since been cultivated in tropical regions around the world. It accounts for most of the United States' coffee consumption.

Unfortunately, that species is particularly susceptible to climate change. In 2012, researchers at England's Royal Botanic Gardens suggested that rising temperatures could make naturally occurring Arabica become a thing of the past, with nearly 100 percent of the places where it grows in the wild—mostly Ethiopia, Uganda and Kenya—becoming unsuitable for the plant by 2080.

The outlook isn't much better for countries in South and Central America that cultivate Arabica. Within a couple decades, researchers fear, coffee might have to be grown in the Northern Hemisphere, putting countries that rely on the crop in an economically tight spot.

"By 2050, Nicaragua will hardly be a coffee producer anymore," says Tim Schilling, executive director of the World Coffee Research Center. "It's possible that instead of sourcing coffee from Guatemala, you'll be doing it from Texas or the south of France."

The good news is that besides Arabica, there's another variety of coffee that is much easier to grow. The bad news? Most coffee lovers agree that it tastes terrible.

--

Essentially all of the world's coffee comes from one of two species: Arabica and Robusta. There are others, but they don't make a dent in worldwide consumption numbers. When Americans think of coffee, they think of Arabica—it's what's used in most drip coffee makers, espresso machines and sold in specialty coffee shops. It tastes smooth and bold.

It also requires "Goldilocks" conditions in order to grow, says Mauricio Galindo, head of operations at the London-based International Coffee Organization, a group that tracks the global coffee market and threats to coffee production.

"Arabicas are the ones at risk—they're very delicate trees," he says. "They depend on conditions that are not too warm, not too cold, not too wet, not too dry."

Besides needing near-perfect conditions to grow, Arabica is also highly vulnerable to a fungus known as coffee leaf rust, a disease that originated in Africa and Asia but has since spread to every coffee-growing region except for Hawaii and Australia. As its name implies, the fungus turns a coffee plant's leaves a dark brown, causing leaves to eventually fall off. An infected tree will have a lower coffee yield and may eventually die.

(Moises Castillo/AP)

Left unchecked, coffee rust has the potential to completely destroy a country's crop. In the mid 1860s, the disease essentially wiped out all of Sri Lanka's coffee plantations. More than 100 years later, Sri Lanka still doesn't have any significant coffee production, according to the International Coffee Organization.

For decades, coffee farmers in South and Central America were insulated from the disease's effects because coffee plants in the Americas are grown in the cool mountains, where temperatures weren't warm enough to be suitable for the plant. But in the 1970s, the first cases of coffee rust reached Brazil, and increasing temperatures and rainfall caused by climate change have allowed the fungus to live at higher altitudes.

According to Galindo, "everything points to climate change being the main factor influencing this explosion in coffee leaf rust."

In February, Guatemalan President Otto Perez Molina declared a state of emergency in the country after an estimated 70 percent of its coffee plants had been infected with the disease. The country's estimated 2013-2014 coffee haul could be reduced by more than 40 percent, and the fungus has caused similar problems for Guatemala's neighbors.

While Arabica coffee around the world has been devastated by coffee rust, Robusta is doing just fine. Generally grown in southeast Asia, parts of Africa and Brazil, the variety can handle wide temperature and moisture changes, is naturally resistant to coffee rust, and is cheap to produce and easy to grow. It's generally used in instant coffee and flavored blends, where its acidic taste can be hidden.

Most coffee drinkers—at least those concerned with taste—don't like it.

"Robusta is much more tolerant of climate change, it has better heat tolerance, it's less dependent on orderly rainfall," Rhinehart says. "Unfortunately it doesn't taste as good in the cup."

That leaves few options for countries such as Colombia, which pride itself on its fine Arabicas.

Coffee is known as an "orphan crop," meaning that, internationally, little money is spent trying to understand how it is grown. There are countless organizations and companies dedicated to trying to grow better wheat, soybeans, corn and rice, an estimated $100 million annually is spent on learning how to grow a better coffee bean.

For decades, developing countries grew coffee and shipped it off to the developed world. The climate in coffee producing countries such as Costa Rica, Colombia, Ethiopia and Vietnam was relatively stable, and coffee hauls were generally predictable. That has changed recently as rust has spread and more variable temperatures have reduced coffee hauls.

"For most of the period we've been importing coffee, it's been grown in countries with emerging economies facing economic challenges," says Rhinehart, of the Specialty Coffee Association of America. "There was no significant coffee production in the industrialized north, so there was no investment from the consuming side into understanding coffee genetics and quality."

Most of those countries couldn't afford to put the resources into coffee research centers—with one notable exception: Colombia.

--

Since 1927, Colombia's Cenicafe research center, located in the country's main coffee hub of Manizales, has been one of the world's most important resources in combating diseases that plague coffee.

By crossing Arabica plants that seem more resistant to rust for several generations, a heartier plant can be grown. It's a process that can take decades: In 1982, Cenicafe released its first coffee rust-resistant bean, called the Colombia Variety. In 2005, it released a second generation plant, called Castillo, which is even more resistant to the fungus.

Though Cenicafe is probably the world's most advanced coffee research center, with more than 60 researchers spread throughout Colombia, it's still fighting an uphill battle against coffee rust.

Due to an abnormally wet season in 2008 caused by La Nina, the country, which historically produces about 12 million 60 kilogram bags of coffee annually, produced just 7.5 million bags as its crop was devastated by rust.

Alvaro Gaitan, a lead researcher at Cenicafe, says the worldwide economic downturn increased the cost of fertilizers and fungicides to a point where coffee farmers in the country couldn't afford them. La Nina caused increased rain and cloudiness throughout the growing season.

"Under those conditions, coffee rust is very happy attacking plants," he says.

Creating a rust-resistant plant is one thing; getting it to Colombia's half million farmers—whose average farm is just 4 acres—and convincing them to use it is another.

Luis Fernando Samper, of the Colombian Coffee Federation, says the Colombian government has spent $1.4 billion over the past five years trying to replace coffee plants with rust-resistant varieties. It costs farmers $1,200 per acre to replace existing coffee plants with resistant strains, and often that money is fronted by the government. The government expects to offer nearly 200,000 loans of about $3,000 each by the time most farmers have replaced their plants with resistant strains.

Replacing the country's entire crop of coffee plants requires outreach to farmers, new banking services for the loans and researcher assistance in choosing which seeds are best to plant in certain regions.

"It's a huge challenge. It's like putting a little orchestra together," Samper says. "Certain farmers are skeptical until we can convince them that the quality is as good or better than what they had before."

Because creating a resistant Arabica plant often requires researchers to cross it with a Robusta plant that naturally has rust resistance, coffee purists have long alleged that rust-resistant coffee doesn't taste as good, a claim that Gaitan denies and says was born out of hastily produced rust-resistant varieties in Central America.

"That's a myth going on in the market. What happens sometimes is if you're not rigorous about quality, you end up with plants that have resistance, but don't taste good," he says.

Rhinehart, whose organization is responsible for setting specialty coffee standards, says that the idea that hybrid coffee plants generally produce worse-tasting beans is, more often than not, true.

"It's not fair to say that efforts to increase resistance to rust necessarily result in bad tasting coffee," he says. "But to date, the best-tasting coffees haven't been rust resistant."

One of the farmers who was eventually convinced to make the switch is Yoli Urresi, a 35-year-old farmer near the tiny southeastern town of Timbio. In 2008, "the seasons varied a lot," she says.

"When it was summer, it rained a lot, more than usual," leading to problems with coffee rust, she says, which led her to switch most of her plants to the Castillo variety three years ago. She is finally able to harvest the beans because it takes up to three years for newly planted coffee trees to bear fruit. In the meantime, she continued to grow some older varieties of the plant in order to keep production up.

"A month ago, there was hail and the Castillo plant has actually been resistant to it," she says. Older varieties of coffee were damaged by the hail.

Colombia's $1.4 billion plan to replace its old coffee plants has enabled the country's coffee production to slowly recover from the 2008 down year.

That recovery can be attributed to Cenicafe, which spent more than 12 years working on its first rust-resistant plants and successfully developed the Colombia Variety a year before the first confirmed case of coffee rust in the country. It has since turned its sights on what Gaitan calls the "varieties of the future," which will have to be even more resistant to climate change and potentially other diseases that have not yet hit the Americas.

"We have been working continuously on this through 80 years of research," Gaitan says.

So while Colombia is already looking past coffee rust, the same can't be said of countries such as Guatemala and Nicaragua, Rhinehart says.

"Colombia has a very sophisticated research program, but its mandate is to improve coffee for Colombian coffee farmers," he says. "By definition, it's not accessible to Guatemalans or Costa Ricans or Kenyans."

Gaitan concurs: "Unfortunately for other countries, there's not a lot of research on coffee. … For those facing the future without good scientific support, it's going to be hard."

That's where the World Coffee Research Center, headquartered at Texas A&M University, comes in. Founded in 2012 and funded by several major coffee roasters including Green Mountain Coffee, the center aims to work with groups such as Cenicafe to find out just what can be done to adapt coffee to global warming.

"There has been no global research effort that links all the different coffee research," says Schilling, the group's executive director. "Colombia has to take care of Colombia. They don't want to share. We're here to work together to produce research that will progress everybody."

For the first time, an international organization is looking at DNA sequencing of coffee plants, trying to improve the species' genetic diversity to better withstand disease and varying climates. Its goal is to eventually create coffee plants that can withstand temperature increases of up to 6 degrees Fahrenheit while "maintaining or increasing quality and yield."

They are trying to recreate in the lab what had been occurring in wild Arabica populations in Ethiopia for years—many naturally occurring coffee plants have evolved to be resistant to rust. Those varieties are often bred together to create more resistant cultivated varieties. But with wild populations quickly dwindling due to increasing temperatures in Africa, Schilling says the "genetic toolbox" that researchers have to play with has "quickly become constrained."

"There's not a lot of building blocks to work with," he says. "For the first time, we're trying DNA resequencing to expand the genetic potential of the species tenfold over what has been utilized before. We're trying to create coffee that's resistant to disease, and has good quality and yielding genes."

--

Despite the ongoing war coffee farmers have been fighting with climate change, consumers have likely not noticed much change in their daily routines. According to the International Coffee Organization, global coffee prices spiked in 2008 due to the scarcity of Colombian Arabicas, but have since fallen to pre-2008 levels as Colombia ramped production back up and farmers in Africa learned that growing coffee under shade trees can effectively lower temperatures by as much as 5 degrees.

But as Central America continues to struggle with coffee rust, worldwide demand for coffee grows and the climate continues to worsen, there's only so much researchers can do. Coffee roasters have already started using more Robusta coffee in blends to get more bang for their buck, and though separate research is being done to improve the taste of Robusta, it's unlikely to ever rival Arabica.

"Robusta farmers have worked on a quantity basis, but in general it's just not as good tasting," Rhinehart, of the Specialty Coffee Association of America says. "It's not impossible to make Robusta taste better, but I haven't seen it yet."

That means Americans might have to get used to worse-tasting coffee if Arabica eventually succumbs to coffee rust, warming temperatures or one of the many other diseases that can affect it.

"In the near term, it's not going to be that you can't get a cup of coffee, but the quality of the cup will suffer," Rhinehart says. "And if we don't dramatically change our approach to carbon emissions, then all the adaptation strategies in the world will be all for nothing, and frankly, the loss of coffee will be the last thing we'll be worried about."