While meteorologists had widely predicted a heatwave for all of California over the Labor Day weekend, beginning on Friday September 1, the predicted high temperature for San Francisco was about 20 degrees off what it became in reality: 106 degrees, smashing a previous record and marking the greatest all-time swelter-fest ever recorded in the city. How could they have been so off?

You'll recall that on August 31, we told you it was going to be a scorcher of a weekend, via the National Weather Service, but they had mostly putting the triple-digit temps inland — they usually are — predicting that Livermore may break its own record and hit 115 degrees. Livermore actually only hit 109 that day, and instead the bubble of high pressure hovered all the way off the coast, keeping even hotter air over generally cooler places like San Francisco. From meteorologists' perspective, they still had the forecast mostly correct, as Monterey-based NWS meteorologist Roger Gass explains this week to Bay Nature, "I guess the surprise was that the marine influence would really shut down."

Also, as it turns out, as many who have lived here a long time should know, San Francisco is a difficult place to predict when it comes to the weather. All it took was a subtle shift in winds from the east to wipe out our marine air conditioner and create what became that 20-degree difference between forecast and reality. And as Bay Nature puts it, "the precision underlying global weather models just isn’t sufficient to determine heat wave temperatures in a seven-mile-square coastal strip like San Francisco."

Gass says, "There was almost nothing to indicate it would be record-breaking at the coast," adding that they knew it would be hot, but "Meteorology is a difficult science."

Thus, you may never want to trust a heatwave forecast again — especially when it comes to temperatures in the city's microclimates, and weather or not it's going to be a beach day. Checking Fog Today in the morning might be a safer bet.

Shortly after the heatwave, we had talk from climate scientists suggesting that we are likely to continue seeing record-breaking temperatures, because that is simply the larger trend nationwide — and SF may as well brace itself for dealing with multiple events a year like the one we just had.

Below, via Bay Nature and UCLA climate scientist Daniel Swain, an explainer about how and why SF experiences heatwaves in May and September/October, via two basic weather patterns:

There are two general patterns of heat in Northern California, Swain says. The first, which is common in the earlier months of summer, is for high pressure to bulge out from the desert southwest, like a giant dome bubbling out of Phoenix to share its insulated warmth. Generally, though, the ocean is still cold from spring upwelling, and so the dome stalls as it reaches the coast, driven back inland by marine air. Those are the familiar June or July conditions that make it 105 in Livermore, 75 in downtown San Francisco, and 65 at Ocean Beach.

The second heat pattern is what happened in early September. Later in the summer high pressure often builds over the Eastern Pacific, moving the center of the heat directly over Northern California and allowing it to envelop even the coast. That’s the pattern that leads to the Bay Area’s notorious Indian summers, and why September and October are the warmest months of the year here. That’s the pattern weather models predicted, and that ultimately materialized, over Labor Day weekend. High pressure paired with warmer coastal waters often leads to it being 110 in Livermore and 85 in downtown San Francisco, and this high pressure also featured such a warm air mass that it seemed it might push everything even a few degrees above typical heat wave highs and into record territory.

Got all that?

No go get yourself one of those standing air conditioners (or a fan) before the next heatwave, because, you know, they sell out.

Related: Ugh: Record-Breaking Heat Could Be Ongoing Trend For SF Bay Area