pvtend.detect_rwb_events

pvtend.detect_rwb_events(field2d_patch: ndarray, x_coords: ndarray, y_coords: ndarray, cfg: RWBConfig | None = None, *, field_nh: ndarray | None = None, lat_nh: ndarray | None = None, lon_nh: ndarray | None = None, centre_lat: float | None = None, centre_lon: float | None = None, method: str = 'bay') list[dict][source]

Detect and classify all RWB bays in a 2D field.

Circumpolar-first mode (preferred):

Pass the full-NH field via field_nh / lat_nh / lon_nh together with centre_lat / centre_lon. The algorithm first finds all circumpolar contours on the full hemisphere, then crops them to the patch for overturning analysis.

Legacy local-patch mode (fallback):

If field_nh is not supplied, falls back to sampled_longest_contours on the local patch.

Parameters:
  • field2d_patch – 2D field on the event patch (nlat_p, nlon_p).

  • x_coords – 1D relative x coordinates (Δlon).

  • y_coords – 1D relative y coordinates (Δlat).

  • cfg – RWB configuration (defaults used if None).

  • field_nh – Full NH 2D field (nlat, nlon). Enables circumpolar mode.

  • lat_nh – Full NH latitude array.

  • lon_nh – Full NH longitude array.

  • centre_lat – Patch centre latitude.

  • centre_lon – Patch centre longitude.

  • method – Classification method – "bay" (default, path-order, no tilt fallback) or "tilt" (centerline-tilt slope).

Returns:

wb_type, area, centroid, contour_level, polygon (xp, yp), interval (xa, xb), method.

Return type:

List of dicts with