aidas.util.azimuth_from_ellipse#

aidas.util.azimuth_from_ellipse(instrument_lon, instrument_lat, radar_image: RadarImage, index=None, area_threshold=20, mask='lakebreeze')[source]#

Fit an ellipse to the detection mask via PCA, find the endpoints of the major axis (leftmost and rightmost mask pixels projected onto that axis), and return the azimuth from the instrument perpendicular to the major axis.

Parameters:
  • instrument_lon (float) – Longitude of the instrument in degrees.

  • instrument_lat (float) – Latitude of the instrument in degrees.

  • radar_image (RadarImage) – The RadarImage object containing the radar data and metadata.

  • index (int, optional) – Time index of the mask to use. If None, uses the first frame.

  • area_threshold (int) – Minimum contiguous area in pixels to retain (removes small speckles).

  • mask (str) – Which detection mask to fit: ‘lakebreeze’ for the inferred lake breeze front, or ‘velocity_wave’ for the radial velocity wave mask from aidas.model.detect_velocity_waves(). A wave train is a far better fit to an ellipse than a single front is, since its bands are parallel.

Returns:

  • azimuth (float) – Azimuth angle in degrees from the instrument, pointing perpendicular to the major axis of the fitted ellipse and toward the ellipse center.

  • left_point (tuple of (float, float)) – (lat, lon) of the endpoint of the major axis with the smallest projection value (i.e. the “leftmost” tip of the ellipse).

  • right_point (tuple of (float, float)) – (lat, lon) of the endpoint of the major axis with the largest projection value (i.e. the “rightmost” tip of the ellipse).

  • center_point (tuple of (float, float)) – (lat, lon) of the centroid of the lake breeze mask.