President Obama disembarks from Air Force One in Miami on May 27, 2015. The president attended two Democratic National Committee fundraisers and visited the National Hurricane Center during his stay. (Lynne Sladky/AP)

With hurricane season on the horizon, President Obama used both a traditional photo op in Miami and a foray into social media to draw Americans’ attention to the harsh impacts of climate change Thursday.

The president toured the National Hurricane Center and then answered questions via his new Twitter account, arguing that his administration is committed to addressing global warming, even as it permits offshore oil drilling.

Within minutes of announcing the chat, Obama was flooded with replies from questioners. Several demanded an explanation for why the Interior Department gave conditional approval this month to Royal Dutch Shell to begin exploratory drilling in the Chukchi Sea off northwestern Alaska.

“Why are you allowing oil drilling in the arctic if you are concerned about climate change?” asked Twitter user Ben Alexander.

The president tweeted a three-part defense:

“1/ We’ve shut off drilling in the most sensitive arctic areas, including Bristol Bay.”

“2/ But since we can’t prevent oil exploration completely in region we’re setting the highest possible standards”

“3/ already rejected Shell’s original proposal as inadequate which shows we’re serious.”

Zebulon Carlander, a Swedish political activist, asked “Mr @POTUS” to explain why he has said that climate change is a national security issue.

The president tweeted in response, “more severe weather events lead to displacement, scarcity, stressed populations; all increase likelihood of global conflict.”

Many of the questions had nothing to do with climate change, instead raising issues on subjects ranging from ongoing trade negotiations to who ranks as the NBA’s best three-point shooter. Obama answered some of those, too, suggesting that the Cleveland Cavaliers’ J.R. Smith and LeBron James, the Golden State Warriors’ Stephen Curry and the Atlanta Hawks’ Kyle Korver are all competitive.

“jr smith having a great season but the heart of the Cavs is Lebron. And no one can outshoot Curry — maybe Korver if wide open,” he tweeted.

But for the most part, the president focused on climate and the environment. At one point he argued that trade negotiations could lead to greater climate protections: “In fact new trade deal [will] have the strongest enforceable environmental provisions in history, raising standards across Asia.”

Before answering questions, Obama received a briefing at the National Hurricane Center, after which he gave brief remarks to the news media.

“The truth is we are better prepared than ever before for the storms of today,” he said, adding that federal officials are “focusing on making ourselves more resilient” to climate impacts such as more-severe flooding.

“The best climate scientists in the world are telling us that extreme weather events like hurricanes are likely to become more powerful,” Obama said. “When you combine stronger storms with rising seas, that’s a recipe for more-devastating floods.”

State and local officials are also preparing for rising sea levels and more-intense storms.

“Some people get swept into office. I floated into office,” said Miami Beach Mayor Philip Levine (D), who won election after a bad flood. On Wednesday, he showed White House senior adviser Brian Deese a torn-up block where the city is raising the level of the roads and installing stronger pumps and one-way valves, all part of a multiyear, $400 million flood-control program.

This year, an El Niño in the Pacific Ocean is altering global weather, and most experts say there should be fewer hurricanes than normal. Federal and city officials, however, are still on alert.

Greg Holland, a senior scientist at the federally funded National Center for Atmospheric Research in Boulder, Colo., said that forecasts show the number of hurricanes could drop by 25 to 50 percent. But he added that although “everyone is pointing to a particularly low season, the question to ask is: What about 1992? That was a particularly low season, but that’s when Miami got wiped out. It only takes one.”

Said Kerry Emanuel, a professor of atmospheric science at MIT: “I don’t like forecasts at all, because people let their guards down. Hurricane Andrew, at the time the most expensive national disaster in the history of the United States, took place in an El Niño year. If you look at statistics, the message is loud and clear: Even in a quiet year, you can get clobbered.”

Miami is one of the country’s most vulnerable cities; its average elevation is about 15 to 17 feet above sea level. Areas near the beach are only two to three feet above sea level, city officials said. As a result, many of the city’s gravity-managed pumps were actually taking water onto land in 1992 when sea levels rose too high in the bay separating one part of the city from another.

“Miami is looking at sort of a bleak scenario — especially Miami Beach,” Emanuel said. “Even on sunny days, if there’s a mild east wind blowing and an astronomical high tide, like a moon tide, you will get street flooding.”

That’s what happened in the neighborhood where the mayor, Levine, and Deese met, near the Sunset Harbour Yacht Club on the bay side of Miami Beach.

Flooding there caused about $10,000 to $15,000 in damage and lost business for Andreas Schreiner, 37, who owns three restaurants on a corner.

Such situations make long-range planners nervous because sea levels have risen half a foot since dire flooding in the 1920s, and climate experts warn that even higher sea levels are on the way.

Levine has been aggressive in undertaking flood-control measures, making him an example of building “resilience” that the Obama administration has praised. The city also is bolstering its building standards.

But Levine said he could use some help paying for it all. He raised storm-water fees by $7 a month per household, an 84 percent increase, and he has shifted money from a different program. Together that covers about half the $400 million cost, and he said he hopes to get federal or state assistance.

Turning to Deese, Levine said, “Hopefully we’ll get a check in the mail,” and he jokingly asked Deese, a former No. 2 official in the Office of Management and Budget, whether he had brought a checkbook or a credit card. Deese laughed wryly.

Later, Deese said that nationwide about $1 billion has been redirected to a competition for resilience projects. The competition has not taken place yet. Although the amount of money is a tiny fraction of what U.S. cities will need to protect against hurricanes and floods, Deese argued that it would inspire innovations that all cities could use. In addition, he said, the president’s budget proposal for fiscal 2016 calls for establishing grants for preparedness against storms.

“If the federal government can invest in resilience, the cost on the back end could be a lot smaller,” he said.

During his time in Miami, the president also met with the parents and sister of slain journalist Steven Sotloff, who was executed in Syria in December by members of the Islamic State. Obama expressed his condolences to Sotloff’s parents, Art and Shirley, as well as his sister, Lauren, according to National Security Council spokeswoman Bernadette Meehan, and “appreciated the chance to hear from the Sotloffs more about Steven’s work as a journalist [and efforts at] making a positive difference, including in Syria.”

On Wednesday evening, Obama headlined two fundraisers in Coconut Grove, Fla., the first held by Joseph L. Falk, a past president of the National Association of Mortgage Brokers and a philanthropist prominent in the LGBT community. About 30 people attended. The second was held by Stephen Bittel, founder of the real estate firm Terranova and a longtime Democratic activist. He had five large round tables, each with about a dozen people who had given the Democratic National Committee up to $33,400.

Although he is not running for office, Obama is still a strong draw for money, and the party is in need.

“I think we’ve realized it’s not just about the president but what we’re dealing with out in the states,” said Carlos Odio, a former Obama White House aide and now managing director of the Florida Alliance. Odio attended one of the fundraisers as a guest of a donor.

But in a state that might produce next year’s GOP presidential standard-bearer, Obama sounded themes — immigration reform and the need for climate action — that could define the difference between Republicans and Democrats.

Saying that “ultimately, an eight-year span in the life of a country is pretty short,” Obama told people gathered Wednesday at Bittel’s house that “part of what we’re also doing is laying the foundation so that we then pass that baton to the next administration and we institutionalize some of the progress that we’ve been making.”

He said he feels different now that his presidency is drawing to an end. “It is a liberating feeling in the sense that the amount of time I have left really concentrates the mind,” he said.