Tracking Hurricanes With AI Weather Models

Author:Murphy  |  View: 29029  |  Time: 2025-03-22 20:05:35

On Wednesday, October 9, 2024, Hurricane Milton made landfall. The storm reached the west coast of Florida during the evening hours. It was the strongest tropical cyclone in 2024 so far.

Here, I explore how the AI weather model PanguWeather predicted hurricane Milton. Code snippets are included to help you replicate and extend my analysis.

AI weather models use historical weather data to predict today's weather.

To generate your own AI weather forecast, you need a pretrained weather model and initialization data. Both are available on Github via the European Center for Medium-Range Weather Forecasting (ECMWF).

I used the pretrained model and initialization data provided by the European Center for Medium-Range Weather Forecasting to create a global weather forecast.

Follow the installation instructions and start the forecast:

ai-models --assets panguweather --input ecmwf-open-data panguweather

The start date for my forecast was Tuesday, October 8, 08:00 AM local time (EDT). It took 1.4 hours to complete on a laptop CPU. With a GPU, PanguWeather could deliver a global forecast in minutes.

PanguWeather predicts the state of the atmosphere in six-hour time steps and with a spatial resolution of 0.25° (25 kilometers). The output file size is 5.5 GB. Technically, the output is three-dimensional, but we are only interested in the lower layer of the atmosphere, right on the ground.

We will use the Python libraries xarray and cartopy to analyze the following aspects of Hurricane Milton:

  • Comparing the AI-predicted storm track to Milton's actual path
  • Sea level pressure at two different points in time
  • Wind speed at landfall

Storm track

To minimize the risk of death and damage from a hurricane, early warning systems are essential. It is important to predict where the tropical storm will make landfall. This is the area where the greatest impact is expected.

Now that Milton has passed, we can compare the AI-predicted storm track to the recorded path.

In the panel, the red circles show Milton's track, as predicted by PanguWeather. The colored circles in the transparent background image show the actual path.

Image created by the author. Recorded storm track created by Tavantius using Wikipedia:WikiProject Tropical cyclones/Tracks. The background image is from NASA. Tracking data is from NHC., Public Domain, https://commons.wikimedia.org/w/index.php?curid=153575499

To create this figure, we first open the output file and select the region of interest. We use xarray, a library that is useful for files that are too large to fit into memory.

import xarray as xr
full_ds = xr.open_dataset('panguweather.grib')
[lat_min, lat_max, lon_min, lon_max] = [20, 35, 270, 290] # Focus on Gulf and Florida
ds = full_ds.sel(latitude=(full_ds.latitude >= lat_min) & (full_ds.latitude < lat_max),
            longitude=(full_ds.longitude >= lon_min) & (full_ds.longitude < lon_max),
            isobaricInhPa=1000, # this pressure level corresponds to the ground
           )

We then extract the center of the storm by finding the minimum of the mean sea level pressure for each forecast step.

centers = []

for step in range(10):
    # track the minimum of sea level pressure
    vals = ds.sel(step=ds.step[step])['msl'].values
    centers.append(np.unravel_index(np.argmin(vals), vals.shape))

center_x = [ds.latitude[c[0]] for c in centers]
center_y = [ds.longitude[c[1]] for c in centers]

Finally, we create a map of the region with cartopy and add the stock image that reflects the natural earth.

fig, ax = plt.subplots(figsize=(10, 4.0), subplot_kw={'projection': ccrs.PlateCarree()})
# Add coastlines and borders
ax.coastlines()
ax.add_feature(cfeature.BORDERS)
ax.add_feature(cfeature.STATES, lw=0.25)

ax.plot(center_y, center_x, transform=ccrs.PlateCarree(), marker='o', color='C3')
ax.stock_img()
ax.set_extent((ds.longitude.min(), ds.longitude.max(), ds.latitude.min(), ds.latitude.max()))

ax.text(*tampa, 'Tampa', transform=ccrs.PlateCarree(), color='C7', ha='left', va='bottom')
ax.scatter(*tampa, color='white', marker='s')

Over the ocean and at the point of landfall, the AI-predicted storm track agrees very well with the recorded path. We observe a small divergence as Milton crosses the state of Florida and enters the Atlantic Ocean.

We should note that at this time, Milton was weakened from a category 5 to a category 1 hurricane. This makes the "eye of the storm" less pronounced, and my method of estimating the storm center will be less accurate.

Mean sea level pressure

Tropical storms are low-pressure systems. The panel shows the mean sea level pressure on Tuesday afternoon (left) and Wednesday afternoon (right). The storm had traveled quite a distance within 24 hours and was moving towards the west coast of Florida.

Image created by the author.

We use cartopy to create contour plots on a map. This is the code snippet to replicate the plot for a given forecast step:

# Cartopy figure with projection
fig, ax = plt.subplots(figsize=(10, 4.0), subplot_kw={'projection': ccrs.PlateCarree()})

# Add coastlines and borders
ax.coastlines()
ax.add_feature(cfeature.BORDERS)
ax.add_feature(cfeature.STATES, lw=0.25)

# for colormap
clevels = np.arange(970, 1030, 5)
step = 6 # change this for other forecast steps

dds = ds.sel(step=ds.step[step])
tampa = [360-82.4572, 27.9506]

# Add contour plot, specifying the transform
contour = ax.contourf(dds['longitude'], dds['latitude'], dds['msl']/100, 
                      cmap='magma', levels=clevels,
                      transform=ccrs.PlateCarree())

cbar = plt.colorbar(contour, ax=ax, orientation='vertical')
cbar.set_label('Mean sea-level pressure (hPa)')

# Add Tampa Fl
ax.scatter(*tampa, transform=ccrs.PlateCarree(), color='white', label='Tampa')
ax.text(*tampa, 'Tampa', transform=ccrs.PlateCarree(), color='white', ha='left', va='bottom')

# Add time stamp
utc_time = pd.Timestamp(dds['valid_time'].values, tz='UTC')
est_time = utc_time.tz_convert('America/New_York')

ax.set_title(est_time.strftime('%A %m/%d %I:%M %p (EDT)'))

Wind speed

The air spins around the center of the storm and can reach very high wind speeds. Milton was initially classified as a Category 5 hurricane, with wind speeds exceeding 70 m/s.

We analyze the wind speed near the expected time of landfall. You can clearly see the "eye of the storm" where the wind speed is low. The wind speed is lower over land than over the ocean. Strong winds over 18 m/s were expected at the coast.

Image created by the author.

Wind speed is not explicitly contained in PanguWeather's output file. We need to calculate it from the variables u10 and v10, which denote the wind speed along the latitude and longitude, respectively. Then we can reuse the script for contour plots from above.

ds['windspeed'] = (ds['u10']**2 + ds['v10']**2)**0.5

Limitations of AI weather models

PanguWeather does not capture the extremely high wind speeds that are associated with hurricanes. The model is trained on weather reanalysis data, which is known to underestimate wind speed.&ved=2ahUKEwjQloDggoKJAxVRSvEDHQOgHgkQFnoECBAQAw&usg=AOvVaw2qY4Jc8Omqid8T9Q8ysHWk).

PanguWeather does not forecast precipitation. This would be essential for assessing the impact of a hurricane.

AI weather forecasts are low resolution compared to modern numerical weather forecasts. PanguWeather provides forecasts with six hour time intervals and 25 km spatial resolution. The leading numerical weather model, ECMWF High-Resolution, provides hourly forecasts at 9 km resolution.

Extreme events are challenging for AI weather models: compared to standard atmospheric conditions, they are encountered less often in training data. In this case, PanguWeather did a very good job capturing Milton's track and intensity.

The forecast is initialized with the most recent publicly available data. The ECMWF provides open weather data with 0.25° resolution. The data is disseminated with a short delay of 1 hour behind the paid tier customers of the weather center.

Nevertheless, open data and pretrained models allow anyone to create global weather forecasts. I hope my article motivates you to explore the intersection of Data Science, deep learning, and meteorology!

References

  • Forecast initialization data: Copyright "© [2024] European Centre for Medium-Range Weather Forecasts (ECMWF)". Source www.ecmwf.int. This data is published under a Creative Commons Attribution 4.0 International (CC BY 4.0). https://creativecommons.org/licenses/by/4.0/. Disclaimer: ECMWF does not accept any liability whatsoever for any error or omission in the data, their availability, or for any loss or damage arising from their use.
  • PanguWeather: Bi, K., Xie, L., Zhang, H. et al. Accurate medium-range global weather forecasting with 3D neural networks. Nature 619, 533–538 (2023). https://doi.org/10.1038/s41586-023-06185-3

Tags: Artificial Intelligence Data Science Data Visualization Science Weather

Comment