If ever there was a glaring example of the havoc and heartache climate change can cause to a farming family, the assortment of chain restaurants, stores and 300 apartments on El Camino Real in Sunnyvale is the one.

The 16-acre development in the heart of Silicon Valley is where Stanford Professor Mark Jacobson’s family had a cherry orchard and fruit stand, called C.J. Olson Cherries, that was a landmark for about a century in the agricultural region once known as the Valley of Heart’s Delight.

The orchard, at the corner of El Camino and Mathilda Avenue, was bulldozed in 1999, one of the last farms in Sunnyvale to be plowed under. But Jacobson said it wasn’t high-tech urbanization that compelled the family to develop the land after more than a century of farming it.

“For five years, from about 1991 to 1996, we didn’t get any cherries,” said Jacobson, a professor of civil and environmental engineering at Stanford University, who blamed a sudden, dramatic decrease in the number of cool, frosty nights that cherries need to blossom. “It had everything to do with climate change. It was the 1990s and it was getting warmer already.”

That’s the kind of collapse that climate scientists are predicting could become common in California over the next few decades, as average temperatures increase anywhere from 3 to 7 degrees Fahrenheit.

Every degree of warming is expected to worsen what, in many ways, is already a crisis for the state’s multibillion-dollar agricultural industry. And a crisis here is a problem everywhere, given that California produces 50% of the nation’s fruits and vegetables and 90% of its nut crops.

But agriculture is beginning to fight back, employing groundbreaking technology and techniques that experts believe will dramatically reduce greenhouse gas emissions, improve the health of livestock, increase food production and maximize the effectiveness of the state’s over-tapped water delivery system.

The Golden State is a role model for the rest of the nation in the deployment of water recycling systems using reverse osmosis, drip irrigation and the seasonal rotation of crops to improve the soil. Grazing is being altered in many places so that it mimics the way native ungulates once used the land; riverside farmland is being flooded during the off-season to help fish spawn; and improvements in livestock nutrition are being developed to reduce methane emissions.

“The ag industry has the capacity to be one of humanity’s great hopes for dealing with climate change, but it’s really going to have to shift course,” said Jacob Katz, lead scientist at the conservation group California Trout, who works with rice farmers to create floodplain habitat for salmon and restore the once carbon-rich peat soils in the Sacramento-San Joaquin River Delta.

Adaptations could protect California agriculture from the worst effects of climate change, but the industry will still face problems due to more droughts, less snowfall and shorter winters as global warming ramps up.

Studies have shown that temperatures have already increased 3 to 4 degrees Fahrenheit in some parts of the Central Valley — like Chico, Davis and the Sierra foothills — since the 1940s. And various studies have also shown dramatic declines since 1950 in tule fog, resulting in fewer hours of temperatures below 40 degrees in growing regions.

That, as Jacobson’s family found out, can be a killer for tree crops like cherries, apricots, peaches, almonds and pistachios. They all rely on the cold to bring on dormancy, a physiological process that helps them produce buds, flowers and fruit during the growing season.

“The last four years have been the four warmest in historical record keeping, and the temperatures are only getting higher and higher,” said Jacobson, who transitioned from family farming in his youth to climate modeling, with a concentration on how warming impacts agriculture. “This is going to keep going on and it’s going to manifest itself in the form of droughts, and in some places, more extreme weather.”

What exactly will it mean for California farmers and ranchers?

Josué Medellín-Azuara, the associate director of the UC Agricultural Issues Center at UC Merced, said the biggest issue will be irrigation. Decreases in the Sierra snowpack mean less melting in the summer, so more rainwater will need to be stored in the winter. Hotter temperatures would also mean crops and orchards will retain less moisture.

“Plants may actually lose water more quickly because of the heat, so they may actually need more water than they need now to survive,” Medellín-Azuara said. This at a time when California is expected to experience more droughts.

Christopher Field, director of the Stanford Woods Institute and the former co-chairman of a U.N. Intergovernmental Panel on Climate Change working group, projects crop losses of up to 40% by 2050, depending on the location.

Field’s color-coded models show reductions in crop output, or yield, in virtually every growing region — particularly in the Sacramento and San Joaquin valleys and in Santa Barbara and Ventura counties, where oranges, walnuts and avocados are grown — even if warming is kept below the accepted international target of 3.6 degrees Fahrenheit.

Wine grapes and almonds would have to be moved farther north, and most other California crops would either disappear or yield a small fraction of their current production if the Earth warmed 7.2 degrees Fahrenheit, which could happen by the end of the century if nothing is done to curb emissions, according to his studies.

“There are likely to be places where farming occurs that will stop,” Field said of his worst-case projections. “You might see a decrease in vineyards in the Sierra foothills, where it is already quite hot for vineyard production. ... In general, the places that could still support agriculture tend (in the models) to be in mountainous counties in the northeastern part of the state, where it isn’t suitable for agriculture.”

With 7.2 degrees Fahrenheit of warming, more than 95% of the land in California currently used to grow crops — excluding wine grapes and possibly marijuana — will no longer be usable.

Exacerbating the situation is the shift by California farmers over the past 25 years away from annual crops to nut trees, which require year-round watering.

Farmers can fallow fields of lettuce and other annual crops during droughts and replant them later. That’s not an option for nut trees, which need 10 years of growth and a steady supply of water before they yield enough to pay for themselves.

But there likely won’t be enough water to keep all the trees alive, and farmers from Fresno to Sacramento face higher prices for precious water. It is why implementation of the state’s Sustainable Groundwater Management Act is so important, said Ellen Hanak, an economist and director of the Water Policy Center for the Public Policy Institute of California.

The law was passed in 2014 in response to the alarming depletion of groundwater reserves in the Central Valley during the five-year drought.

Hanak said recharging the overused California aquifer will require investment in programs to recycle and inject water into the ground and necessitate a 10% reduction in farming acreage over the next 20 years.

“This region has been using more groundwater than it has naturally replenished for decades,” Hanak said. “Fixing that is going to be a heavy lift, but it’s going to be better for the economy and for jobs.”

But if projections are accurate, hardly any land will be suitable for agriculture where crops are currently being grown unless major investments are made in adaptive farming and conservation.

Frank Mitloehner, a professor in the UC Davis animal science department, said that is why sensors are being installed to monitor water use, and more ranchers are adopting regenerative farming and grazing techniques that ensure the land sequesters more carbon than it emits.

Mitloehner said new anaerobic digesters, which convert manure into energy, and advances in nutrition are reducing methane from manure and burping cows. He said the dairy and livestock industries are on pace to meet the requirements of a 2016 law that requires agriculture to curb methane emissions 40% by 2030.

“I don’t think we have the luxury of saying we can’t do anything or won’t do anything,” Mitloehner said. “We are actively fighting climate change.”

Katz of Cal Trout would like California to create more incentives for farmers in the Central Valley to improve the landscape — like planting native riparian vegetation on land not occupied by crops or flooding rice fields to create floodplains during the winter for migrating birds and salmon.

“Right now, we have a whole system that incentivizes mining the Central Valley for the fertile soil to make low-quality food,” he said. “We need to pivot away from that and take into account the processes that govern the natural landscape and learn to work with nature rather than against it.”

One farmer who is doing that is Kelly Mulville, the general manager at Paicines Ranch, a 7,600-acre plot of land south of San Jose, where sustainability and resilience have become an all-encompassing mission.

Mulville has developed a system in which he rotates cattle, sheep and turkeys on portions of the ranch, never leaving them in one place longer than five days. This keeps the weeds down and fertilizes the soil naturally. When livestock isn’t grazing, the land is used to grow wine grapes, oats, rye grasses, radishes, beans and peas.

“We integrate animals to do a lot of the work machinery used to do, recycling nutrients back into the ground,” said Mulville, who maintains that livestock and crop health increased dramatically within 18 months of implementing his system six years ago. The nutrient-rich soil now retains more water than ever.

“We are trying to increase the diversity and put the plants and animals together because they evolved together,” he said. “That produces soil and plant productivity, and we are actually capturing carbon out of the atmosphere. If all the big farms did this it would have huge implications. It’s probably our only chance to veer away from the iceberg.”

It’s already too late for Jacobson, whose great-grandfather started the family farm in 1899. Now, all that’s left to sustain the locals is a P.F. Chang’s and Starbucks.

“Now, cherries in California are mostly coming from Washington state,” he said, adding that farmers who don’t want to suffer the same fate as his family will have to shift to other growing locations. “There is going to be some shifting.”

Peter Fimrite is a San Francisco Chronicle staff writer. Email: pfimrite@sfchronicle.com Twitter: @pfimrite