Skip to main content

Parametric tropical cyclone 2D wind and pressure fields

Project description

tcwindfields

Parametric 2D wind and pressure fields for tropical cyclone tracks.

Given a TC track (position, intensity, size), tcwindfields produces gridded uwnd, vwnd [m/s] and pres [Pa] fields as an xarray.Dataset ready to save as NetCDF.

Wind models: Chavas, Lin & Emanuel (2015) CLE15 (default), or Holland (1980) (selectable via wind_model='cle15' / wind_model='holland').

Pressure model: Holland (1980) radial profile with the Willoughby & Rahn (2004) empirical B parameter.


Installation

pip install tcwindfields

Dependencies: numpy, scipy, shapely, xarray, pandas, tqdm


Example: TC Alfred (2025)

import urllib.request, pathlib
import numpy as np
import xarray as xr
import tcwindfields as tcwf

# --- Download IBTrACS (last 3 years, ~10 MB) ---
url  = ("https://www.ncei.noaa.gov/data/international-best-track-archive-for-"
        "climate-stewardship-ibtracs/v04r01/access/netcdf/"
        "IBTrACS.last3years.v04r01.nc")
dest = pathlib.Path("IBTrACS.last3years.v04r01.nc")
if not dest.exists():
    urllib.request.urlretrieve(url, dest)

# --- Extract Alfred ---
ds_ib   = xr.open_dataset(dest)
names   = np.array(ds_ib['name'].values.astype(str))
seasons = np.array(ds_ib['season'].values.astype(int))

idx    = int(np.where((names == 'ALFRED') & (seasons == 2025))[0][0])
ds_tc  = ds_ib.isel(storm=idx)

lons_tc = np.array(ds_tc['lon'])
lats_tc = np.array(ds_tc['lat'])
time_tc = np.array(ds_tc['time'])
vmax_tc = np.array(ds_tc['bom_wind']) / 1.94384 # knots --> m/s
pmin_tc = np.array(ds_tc['bom_pres'])           # hPa
rmax_tc = np.array(ds_tc['bom_rmw'])  * 1.852   # n mi  --> km

# Fill RMW gaps with Willoughby & Rahn (2004)
rmax_tc = tcwf.fill_rmax_gaps(rmax_tc, vmax_tc, lats_tc)

# Drop rows with missing position / intensity
valid = ~(np.isnan(lons_tc) | np.isnan(lats_tc) | np.isnan(vmax_tc) | np.isnan(pmin_tc))
lons_tc, lats_tc, time_tc = lons_tc[valid], lats_tc[valid], time_tc[valid]
vmax_tc, pmin_tc, rmax_tc = vmax_tc[valid], pmin_tc[valid], rmax_tc[valid]

# Filter to dates of interest
t0 = np.datetime64('2025-02-28T12:00:00')
t1 = np.datetime64('2025-03-08T18:00:00')
mask = (time_tc >= t0) & (time_tc <= t1)
lons_tc, lats_tc, time_tc = lons_tc[mask], lats_tc[mask], time_tc[mask]
vmax_tc, pmin_tc, rmax_tc = vmax_tc[mask], pmin_tc[mask], rmax_tc[mask]

# --- Compute 2D fields ---
lons_grid = np.arange(149.0, 160.0, 0.05)
lats_grid = np.arange(-33.0, -21.0, 0.05)

ds_wnd = tcwf.compute_tc_fields(
    time_tc, lons_tc, lats_tc, vmax_tc, pmin_tc, rmax_tc,
    lons_grid, lats_grid,
    interp_interval='1h',
)
ds_wnd.to_netcdf('Alfred_2025_TC_winds.nc')

tcwf.compute_tc_fields(...)

Main function. Returns an xr.Dataset with dimensions (time, lat, lon).

Input variables:

Parameter Type Units Description
times np.datetime64 array Track times
lons float array degrees E TC centre longitude
lats float array degrees N TC centre latitude (negative = SH)
vmax float array m/s Maximum surface wind speed
pmin float array hPa Minimum central pressure
rmax float array km Radius of maximum wind
lons_grid 1-D float array degrees E Output grid
lats_grid 1-D float array degrees N Output grid
interp_interval str or None e.g. '20min', '1h'; None = no interpolation
wind_model str 'cle15' (default) or 'holland'

Output variables:

uwnd (m/s), vwnd (m/s), pres (Pa).

tcwf.fill_rmax_gaps(rmax_km, vmax_ms, lats)

Fill NaN values in a rmax array using the Willoughby & Rahn (2004) empirical formula. Observed values are kept unchanged.

tcwf.interpolate_track(times, lons, lats, vmax, pmin, rmax, interval='1h')

Interpolate track arrays to a regular time step. Returns a dict with the same keys. Useful for pre-processing before calling compute_tc_fields.

tcwf.input_units()

Print a summary of all required input units and default model parameters.


References

  • Chavas, D. R., Lin, N., & Emanuel, K. (2015). A model for the complete radial structure of the tropical cyclone wind field. Part I: Comparison with observed structure. Journal of the Atmospheric Sciences, 72(9).3647-3662.
  • Emanuel, K., & Rotunno, R. (2011). Self-stratification of tropical cyclone outflow. Part I: Implications for storm structure. Journal of the Atmospheric Sciences, 68(10), 2236–2249.
  • Emanuel, K. (2004). Tropical cyclone energetics and structure. Atmospheric Turbulence and Mesoscale Meteorology, 8, 165-191.
  • Holland, G. J. (1980). An analytic model of the wind and pressure profiles in hurricanes. Monthly Weather Review, 108(8), 1212-1218.
  • Willoughby, H. E., & Rahn, M. E. (2004). Parametric representation of the primary hurricane vortex. Part I: Observations and evaluation of the Holland (1980) model. Monthly Weather Review, 132(12), 3033-3048.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tcwindfields-0.2.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tcwindfields-0.2.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file tcwindfields-0.2.0.tar.gz.

File metadata

  • Download URL: tcwindfields-0.2.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for tcwindfields-0.2.0.tar.gz
Algorithm Hash digest
SHA256 31a0eb8a24b6df8bf7bac329b2fa0eeaa63b40a2b19dbeb399c7d2852de74331
MD5 04130b0824b98e6f45c5eb8fd92fa055
BLAKE2b-256 ec05e38942450d79d4702b28f1d66ecd0f1134be047f2dea5c8c67769612dfa5

See more details on using hashes here.

File details

Details for the file tcwindfields-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tcwindfields-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for tcwindfields-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 000564f8ed15f2e8d937ab41fdf76cce0a56fe181a3a2c85c39fdf5e0a4aa175
MD5 45df006ea18302676afc7c7a60ea888f
BLAKE2b-256 8d83456f6fcdab7940a6d3a017840d901eb4927622aee56d7b9f492c303f005a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page