At the Gless family's sprawling citrus ranch north of Los Angeles, a massive excavator twists and bends, digging a private reservoir on drought-parched land that just a few months ago contained 400 orange trees.

As California confronts its fourth year of scorching drought, growers like John Gless are spending millions to protect themselves against future water shortages, digging reservoirs, sinking deep wells and installing computerized drip irrigation systems.

"This is a very big, very expensive reservoir which we certainly wouldn't have done before," said Gless, whose family company, Gless Ranch, grows mostly citrus on 6,500 acres in the southern and central part of the state, much of it in California's San Joaquin Valley breadbasket.

California leads the nation in production of fruits and vegetables, its nearly 80,000 farms and ranches taking in total revenues of $46.4 billion in 2013, state data show.

But the relatively dry parts of the state where much of its farming is rely on irrigation rather than rainwater, and environmental concerns brought on by the drought have led to a sharp reduction in the amount of water for farmers to buy.

The past year has been particularly hard on San Joaquin Valley citrus farmers, many of whom were somewhat insulated against those reductions until last year, when water supplies from a federal project that distributes water from the large but ecologically fragile San Joaquin-Sacramento River Delta were cut off.

Since then, citrus farmers statewide have pulled out about 20,000 acres of trees, losing investments that will take decades to recoup and costing consumers higher prices for oranges, lemons and limes, said Joel Nelsen, president of the California Citrus Mutual growers group.

Along with grape growers in the same region, some citrus farmers have responded by putting in reservoirs - many in the perhaps quixotic hope that the weather and oceanic phenomenon known as El Nino will bring storms next fall and winter to fill them.

Gless, skeptical of that possibility, plans to use his reservoirs to store water pumped from his wells, in order to direct water to citrus groves that need it most. He has spent about $5 million to dig two reservoirs and sink four wells, each 2,000 feet deep, to feed them.

The state does not keep records on this type of private reservoir because the farmers are not damming streams to build them. But interviews with farming experts and companies that install ponds and reservoirs indicate that more are going in.

Environmental Concerns

Ray Ogden, who builds reservoirs for farmers in California's Coachella Valley, a desert area east of Los Angeles where citrus is also grown, said business has gone up dramatically since the drought began.

"In the last three years, we have put in more agricultural reservoirs than we have in the previous 20," Ogden said. His customers are installing them along with water-saving drip irrigation systems to conserve water purchased from the Colorado River and other sources, Ogden said.

At Oregon-based BTL Liners, 40 percent of recent sales of polyethylene liners for irrigation reservoirs have been to California farmers this year, up from 25 percent in most years before the drought, said CEO Michael Baron.

The reservoirs are not made in the traditional way, by damming a stream, but rather are more like very large ponds. Many are fed by pumps that go deep into the land.

Farmers are turning to that groundwater at a time when there is growing concern about both its quality and availability.

Three years of drought have caused the water table to recede, and increasing use of wells to pump it out for irrigation has sped up that process. In some areas, the ground itself has begun to sink.

California is developing its first-ever regulations for ground water pumping to deal with the problem, but they likely won't take effect for years, said David Gutierrez, a water expert who is heading the state's effort.

"It's out of balance," Gutierrez said. "The groundwater is not getting restocked as quickly as they're taking it out to irrigate their land."

Growers say they have little choice.

Farmers who raise vegetables can fallow their land if they don't have water to irrigate it - and many have.

But trees must be watered regularly or they will die.

Gless, who pulled out 60 acres of oranges and tangerines last year, uses a drip system that is so precise that the water has to be filtered so the tiny nozzles that drip the water don't clog.

Even so, with little water available for purchase this year, his wells have been pumping around the clock since April. He hopes his reservoirs, once filled, will give him some choices in where to direct the water.

"We're not going to have to pull out any permanent crops this year," he said. "But how long can you keep this pace up?"