adam.util.azimuth_from_ellipse#
- adam.util.azimuth_from_ellipse(instrument_lon, instrument_lat, radar_image: RadarImage, index=None, area_threshold=20)[source]#
Fit an ellipse to the lake breeze 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).
- 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.