BOSTON—Steven Miller watched the flooding of New York City during superstorm Sandy with a mixture of awe and dread. If New York’s subway tunnels could be inundated, he wondered, what about Boston’s “Big Dig,” the road network under the city and harbor?

Mr. Miller, a geologist at the Massachusetts Department of Transportation, helped develop a computer model to answer that question. It concluded that while the Big Dig could handle the floods of the past, it couldn’t withstand what was predicted for the future. Neither would entire Boston neighborhoods.

A glimpse of that future arrived earlier this month when a severe winter storm walloped Boston. A tidal surge pushed Boston Harbor to the highest level ever recorded by the National Weather Service and sent icy water into the streets of several neighborhoods.

What to do about extreme weather has become one of the most vexing questions facing public officials in cities around the country. After a succession of storms with steep price tags—including hurricanes last year that battered Houston, Florida and Puerto Rico—many have concluded they aren’t prepared, if predictions of rising seas and more intense storms come to pass.

Compounding the challenge is the difficulty of predicting with certainty future sea levels and storms, in a time when climate change remains politically polarizing.