“We have a saying: You don’t plant pistachios for yourself, you plant them for your children and your grandchildren,” said Bob Klein, manager of the California Pistachio Research Board. “Now perhaps it’s not so much for your kids and your grandchildren” as the future climate has become so uncertain , he said .

Wonderful Orchards took the stopgap step of planting some experimental male trees that shed pollen at various times, hoping their cycles would match more females.

The company is still waiting to see if any of its efforts will work.

“It’s a challenge for all permanent crops, because it takes so long,” Mr. Yraceburu said. “Others like carrots or lettuce are 90-day or 120-day crops, so you can try something and know right away if it works. For trees, you don’t even get any results until four to eight years down the road. You don’t know if your experiment works for a long time.”

For some crops, scientists are going back to their origins, searching, for instance, for old varieties of nuts grown in the Middle East. “All of the things we grow in California have a wild relative or a variety on the market elsewhere that does O.K. with warmer winters,” Dr. Jarvis-Shean said.

The Agriculture Department has repositories that store genetic material from every type of tree on earth. Dan Parfitt, a now-retired University of California-Davis plant geneticist, started breeding pistachios using tissue from those repositories more than 30 years ago in an effort to help growers economize their harvest.

As the climate changed, Dr. Parfitt got the idea to plant a few hundred of the trees in the California desert. “The Coachella Valley is the closest to the warmer winters and drier conditions that we will see in the San Joaquin Valley in 20 to 30 years,” he said.

These new breeds go by an array of odd names : Gumdrop, Tejon, Lost Hills, Famoso . Many growers have already planted some in their orchards. Dr. Parfitt is confident that the pistachios of the future will be dominated by trees bred for climate change.