pvtend.circumpolar_contours

pvtend.circumpolar_contours(field_nh: ndarray, lat_nh: ndarray, lon_nh: ndarray, try_levels: int = 300, min_vertices: int = 30, min_lon_span: float = 355.0) list[dict][source]

Extract circumpolar contours from a full Northern-Hemisphere field.

Mimics the MATLAB blue_circumcontour approach:
  1. Double the field in longitude to handle periodicity.

  2. Run find_contours at try_levels evenly-spaced values.

  3. Keep only the longest contour at each level that spans ≥ min_lon_span degrees of longitude (i.e. circumpolar).

  4. Return contours in (lon, lat) geographic coordinates.

Parameters:
  • field_nh – 2-D array (nlat, nlon), NH field (e.g. Z at one pressure level). Latitude axis must be ascending (equator → pole) or descending — handled automatically.

  • lat_nh – 1-D latitude array corresponding to axis 0 of field_nh.

  • lon_nh – 1-D longitude array corresponding to axis 1 (0→360 or −180→180).

  • try_levels – Number of contour levels to probe.

  • min_vertices – Minimum contour vertices.

  • min_lon_span – Minimum longitude span to qualify as circumpolar.

Returns:

List of dicts {'lev': float, 'lon': ndarray, 'lat': ndarray} with coordinates in the original geographic system.