The best of EcoWatch, right in your inbox. Sign up for our email newsletter!

California Gov. Jerry Brown (D) took a shot at Sec. of Energy Rick Perry, former Republican governor of Texas. Remarking on Perry's view of Texas as an energy powerhouse, Brown said, "We've got more sun than you've got oil."

Recent data shows California coming through. The state briefly generated enough solar power to meet nearly half of the state's electricity needs, according to data from the largest grid operator in the state, California ISO.

Around midday on March 3, demand reached around 29 Gigawatts (GW), while solar was providing nearly 14 GW of generation—some 9 GW from utility-scale arrays and another 5 GW or so from rooftops and parking lot canopies around the state.

Renewables are having a big moment. Solar is getting cheaper and cheaper, spurring Californians to set up photovoltaic panels on homes, businesses and empty lots across the state.

"It's remarkable that over a third of the solar power generated in California comes from smaller rooftop systems, meaning hundreds of thousands of homeowners are reaping the economic value generated from harnessing the sun rather than the state's big utility companies," said Amit Ronen, director of the GW Solar Institute.

To be fair, the numbers from California ISO are a little squishy. First, California ISO may be the biggest grid operator in California, but it is not the only grid operator. Its numbers do not account for power demand or solar generation in Los Angeles or Sacramento, for instance.

Second, there is no real-time data on California's rooftop solar generation. We know that California has about 5 GW of installed rooftop solar capacity, meaning that if every rooftop solar panel in the state pointed directly at the sun on a cloudless day, they would generate more than 5 GW. Under real-life conditions, they generate slightly less.

But while these numbers are a rough approximation, they illustrate the incredible growth of renewable energy. They also highlight the central challenge of integrating solar into the power grid.

California's net power demand, midday on March 3. California ISO

See the dotted blue line in the graph above? That represents estimated demand. The saddleback-shaped dip in the line is the handiwork of rooftop solar panels, which generate power locally, suppressing demand. After the sun sets, around 6 p.m., demand shoots up again.

But solar power isn't just coming from rooftops. It's also being generated by large-scale arrays operated by utilities. Subtract the electricity generated by utility-scale renewable energy and you get the net power demand, represented by the green line. The green line shows how much energy conventional power plants need to generate to keep the lights on in California. That enormous dip and the subsequent spike, form what energy geeks call the duck curve.

The duck curve, as illustrated by changes in changes net power demand in California. CAISO

Every year, California generates more and more power from solar, exacerbating that midday dip in net power demand. This is problematic, because it's expensive to ramp up power generation from coal- and gas-fired power plants at dusk. Fortunately, there are ways to flatten the duck curve: building out transmission lines to carry solar energy over state lines would broaden the demand; installing grid-enabledappliances that shift demand to the middle of the day; or deploying battery storage, like the Tesla Powerwall, that can store excess generation during the day and discharge it in the evening.

"We still need to make significant investments in energy storage technologies that will allow us to bank solar energy when it's being made so that it can be used whenever we need it, even at night," Ronen said.

The state is aiming to generate 50 percent of its power from renewables by 2030. As part of that effort, legislators are looking for ways to better integrate solar energy into the power grid—to drive down costs, improve performance and flatten ducks, wherever they may quack. So, in September, California passed four bills to expand the use of energy storage.

U.S. Supreme Court Justice Louis Brandeis once described the states as laboratories of democracy. They are also laboratories for energy innovation. As the federal government lurches backwards on renewable energy and climate, California and other progressive states are pushing ahead, providing a model for the rest of country.

Should Texas, for example, want to take advantage of its abundant sunshine, California can show the Lone Star state how to do it.