huracanpy.calc.corral_radius#

huracanpy.calc.corral_radius(lon, lat, time=None, track_id=None, *, window=None, min_points=None)[source]#

Find the minimum radius encircling a set of points

By default, calling corral radius with a set of lons/lats will return the corral radius for all these points. The returned array with have the same length as lons/lats, but the same value for all points

>>> corral_radius(lons, lats)

If you also pass a track_id, the corral radius is calculated separately for each unique track. The returned array still has the same length as lons/lats so the value for each track is repeated

>>> corral_radius(lons, lats, track_id=track_id)

Passing a time and window will calculate the corral radius in a rolling window. The window is by default in hours (you can explicitly pass a datetime.timedelta to use a more specific window). The code below will calculate the corral radius for each lon/lat include the lons/lats withing +/- 36 hours. Points where the window is outside the times are given NaNs

>>> corral_radius(lons, lats, time=time, window=36)

Including both a track_id and a time/window will ensure the corral radius is calculated separately for each track, leaving NaNs at the start and end of each track where the time window is outside the track times

>>> corral_radius(lons, lats, time=time, track_id=track_id, window=36)
Parameters:
  • lon (array_like) – Longitude and latitude points

  • lat (array_like) – Longitude and latitude points

  • time (array_like, optional) – Time at each point

  • track_id (array_like, optional) – Track ID at each point

  • window (scalar or datetime.timedelta, optional) – Half-width of the window. i.e. include all times within +/- window

  • min_points (int, optional) – Minimum number of points required in the window.

Returns:

Corral radii in metres (NaN if not computed)

Return type:

np.ndarray