A shift from U.S. grown flowers to imports and a 2017 shift to legalized cannabis for adult use is merging along the coast in California.

Santa Barbara County has amassed the largest number of cannabis cultivation licenses in California since broad legalization arrived on Jan. 1 — about 800, according to state data compiled by The Associated Press. Two-thirds of them are in Carpinteria and Lompoc, a larger agricultural city about an hour’s drive to the northwest.

Virtually all of Carpinteria’s licenses are for small, “mixed-light” facilities, which essentially means greenhouses.

The result is a large number of licenses but small total acreage. Only about 200 acres of the county’s farmland is devoted to cannabis, compared with tens of thousands sown with strawberries and vegetables, said Dennis Bozanich, who oversees the county’s marijuana planning.

The area’s greenhouses have their roots in Carpinteria’s cut flower industry, which was sapped after the U.S. government granted trade preferences to South American countries in the 1990s to encourage their farmers to grow flowers instead of coca, the plant used to make cocaine.

In an ironic twist, some California flower growers weary of import competition have started trying to grow cannabis, a plant that, like coca, is deemed illicit by the federal government. Others have sold their greenhouses to cannabis investors.

“We have literally no carnation production in the United States any longer because South America grows them so cheaply,” said Kasey Cronquist, chief executive of the California Cut Flower Commission. “Farmers had to move crops, and that is what we have seen happen over time — they’ve gone to crops that are more valuable or more difficult for Ecuador and Colombia to ship.”

Domestic cut flower growers saw their share of the U.S. market drop to 27 percent in 2015 from 58 percent in 1991. Sales of imported cut flowers grew to more than $1 billion during the same period, according to data compiled by the commission.

Greenhouses that once produced flowers are seen as ideal for cannabis. In the county’s climate, the greenhouses heat and cool easily and inexpensively, and the plants thrive. It takes only about three months to grow cannabis in pots of shredded coconut husks, so farmers can get multiple harvests each year.

In the hills of the so-called Emerald Triangle of Northern California, where most of the state’s pot is grown, there is a single harvest each year.