Climate change is rapidly becoming America’s biggest economic and business challenge, and no state is doing more to address it than California. The Golden State has not just led the way in challenging the do-nothing policies of the Trump administration by requiring its electric companies to switch to renewable energy sources and preserving higher fuel efficiency standards for cars. No less impressive is how it has stepped up to deal with what has become the most dangerous and costly manifestation of global warming: wildfires, which have already claimed dozens of lives, destroyed billions of dollars in property and bankrupted the state’s largest electric utility.

Last month, the California legislature — with a two-thirds majority, no less — passed the creative proposal from Gov. Gavin Newsom (D) to reduce the risk that utility power lines will spark wildfires and to socialize the cost of compensating victims when those measures fail.

Under the plan, shareholders of the state’s three private utilities will contribute $10.5 billion to a state-run compensation fund, while their customers will contribute an equal amount in higher electric rates. In addition, utilities are required to invest another $5 billion to “harden” their power lines — make them less spark prone — which will eventually also be recouped through higher rates. Bottom line: lower profits for the utilities and higher rates for consumers and businesses already paying some of the highest in the nation.

Perhaps the most controversial aspect of California’s wildfire plan isn’t about money: It’s about inconvenience. As a last line of defense, the state’s electric companies are now required to develop the capacity to cut off power in areas where the winds are so strong and the brush is so dry that there is high risk for a disastrous fire. In the utility world, the polite term is “de-energization,” and one California company — San Diego Gas & Electric, or SDG&E — has now developed it into something of a science.

Following wildfires in 2007 that killed at least 10 people, destroyed about 1,700 homes, forced the evacuation of half a million residents and exposed the company to $2.4 billion in damage claims, SDG&E decided to get serious about wildfire prevention.

Its $1.5 billion program has involved replacing or burying nearly two-thirds of its big transmission lines in high-risk areas, with the rest due to be completed by 2025. It has meant dispatching 80 crews to cut down trees and branches that might fall on its lines. It has installed 100 mountaintop cameras to provide real-time surveillance of the remote backcountry crossed by its transmission lines. Its computers can now turn off power to a snapped transmission line before it even has time to fall and hit the ground. SDG&E even has an air force that boasts two helicopters, including one that can drop 2,650 gallons of water in a single pass, along with a fleet of 25 drones that inspect power lines and give firefighters a bird’s-eye view of the fire they are fighting.

The most impressive parts of the program involve big data and sophisticated software.

Using mountains of historical and real-time satellite data on the amount of moisture in the soil and vegetation, and localized data on wind speeds, temperature and humidity gathered from 175 solar-powered weather stations mounted on power poles, a team of SDG&E meteorologists developed a computer model that can pinpoint where and when a big, damaging wildfire is likely to occur if something comes along to ignite it.

It’s not a prediction exactly, because the likelihood of a spark at any particular place is unknowable. “Conditional probability,” is how Brian D’Agostino, the company’s director of fire science and climate adaptation, describes it. Whatever you call it, SDG&E officials now rely on it in deciding when to warn customers and fire crews several days in advance of a possible shut-off. If weather unfolds as the model predicts, then power can be cut to any of the 75 circuits in the high-risk area, with each circuit serving anywhere from two to 2,000 customers.

“We are doing with wildfires what the National Weather Service has done with hurricanes,” said Scott Drury, the utility’s president.

In each of the past two years, about 20,000 SDG&E customers have had their power cut for periods ranging from one to four days. While it is impossible to say with certainty whether the shut-offs have actually prevented a wildfire, regulators and fire officials are encouraged by the fact that, despite dangerous conditions that led to utility-caused fires elsewhere in the state, there has been none in the San Diego region since 2007.

Back in 2009, when SDG&E first asked for permission to selectively shut off service, the state’s public utilities commission refused, citing the threat to health and public safety if power were shut off to hospitals, first responders, sick people on respirators and homeowners pumping water from their wells.

Politicians were also opposed, none more so than Dianne Jacob, the county supervisor who represents the rural eastern part of San Diego County where the shut-offs are most likely to occur. For a decade, Jacob has been a thorn in SDG&E’s side, using the media and letters to regulators to accuse the utility of putting the financial interests of its shareholders over the safety, convenience and livelihoods of its customers.

“All they care about is their bottom line,” said Jacob, a 27-year veteran on the county board who speaks with the calm authority of the sixth-grade teacher she once was. “If they want to prevent wildfires, if they want to avoid those expensive damage claims, then all they have to do is pay to harden their infrastructure.”

Unfortunately, it’s not that simple. Although installing taller, stronger metal transmission poles and providing greater distance between the wires significantly reduces the risk of sparks caused by wind and flying debris, it cannot eliminate it. There are also limits on how fast the hardening can be done. There are only so many trained workers capable of doing the work, and there are operational constraints of how much of the grid can be put offline at any one time. Financially, however, the utility would actually benefit from completing the upgrades more quickly, since the spending could be added to its rate base. The disincentive is political: Faster spending would cause rates to rise precipitously.

Although California regulators began to open the door to power shut-offs beginning in 2013, the public remained unconvinced until last fall, when the devastating Camp Fire in Northern California burned down the town of Paradise, killed 85 people, caused more than $16 billion in property damage and forced PG&E to file for bankruptcy protection. Weeks before the Camp Fire, with dry conditions and strong winds forecast, PG&E had shut off power in several communities and was met with serious pushback from angry customers. When similar conditions arose again in early November, PG&E again warned 70,000 customers of another possible shut-off, but in the end decided not to pull the plug. State fire officials would later conclude that the fire, ignited by a utility spark, had already begun to spread by the time the unaware utility was telling customers that the danger had passed.

Following the Camp Fire disaster, California regulators ordered its utilities to establish procedures and criteria for power shut-offs when wildfire risks are at their peak. As a result, other utilities are now scrambling to develop their own data collection and modeling capabilities, borrowing heavily from the work already done by SDG&E.

“It’s pretty clear they have better meteorological data, and better fire risk models, than anybody else,” said Michael Picker, who stepped down last month as the chairman of the California Public Utilities Commission.

People who estimate fire risk for a living agree. SDG&E’s premiums for liability insurance are substantially below those of other California utilities.

As Drury, SDG&E president, sees it, the wildfire model gives SDG&E the confidence to shut off power because it can pinpoint precisely where and when the risks are at levels that have resulted in disastrous fires in the past. And thanks to machine learning, a form of artificial intelligence, the model’s predictive powers improve with every fire. Without those insights, he said, he would be faced with the Hobson’s choice of shutting power off to tens, if not hundreds, of thousands of customers at a time, causing massive disruption, or risking another disaster for his company and his customers by never pulling the plug.

As a result of the success of SDG&E’s wildfire model, the debate in California has now turned from whether to allow power shut-offs to how to better manage the shut-offs when they occur.

Utility companies are now required to have elaborate procedures for warning customers of possible shut-offs using all the tools of modern communication, including emails, texts, automated phone messages and social media. Arrangements must be made to provide alternative sources of power for hospitals, nursing homes, first responders and customers with special medical needs. Utilities are also setting up centers in each community where customers can go to get water, recharge cellphones, refrigerate medicines and get up-to-date information.

Households, businesses and local governments are also learning to adapt, albeit grudgingly. Sales of generators, solar panels and storage batteries have increased. In fire season, residents make a point of using up what food is in their freezers and parking their cars on the street rather than in garages with electric door openers. Farmers and ranchers search for ways to store water to tide them over when the electric pumps aren’t working.

In the end, however, there are unlikely to be any fixes for lost days of sales and lost work because the lights and computers are out, or sleepless nights without air conditioning. No less than the higher electric rates and lower profits, these, too, are part of the irreducible costs of climate change.

In tackling the threat of wildfires, California is going through an exercise that the rest of us will have to do at some point: determining how much we are willing to pay, and how much we are willing to change the way we live, to adapt to the threat of natural disasters caused by global warming. At the national level, politics has become so dysfunctional that making such difficult trade-offs seems hard to imagine, while in other coastal states such as Florida, politicians and voters remain in stubborn denial. With remarkable ingenuity and courage, however, those crazy Californians are showing how it can be done.