asi_core.image.circumsolar

This module provides functions to analyse ASI (All-Sky Imager) images.

Functions

get_sun_pos_in_asi_image(sun_ele, sun_az, ele_mat, az_mat)

Determines the pixel position of the sun in an ASI image.

compute_sun_dist_map(sun_ele, sun_az, ele_mat, az_mat)

Computes the distance map from each pixel to the sun in an ASI image.

compute_cloud_coverage_and_distance_to_sun(seg_mask, ...)

Computes cloud coverage and the minimum distance between clouds and the sun.

get_sun_dist(az, ele, timestamp, location)

Calculate the sun distance angle based on azimuth and elevation angles.

get_saturated_mask(img[, saturation_limit, ...])

Module Contents

asi_core.image.circumsolar.get_sun_pos_in_asi_image(sun_ele, sun_az, ele_mat, az_mat)

Determines the pixel position of the sun in an ASI image.

Parameters:
  • sun_ele – Sun elevation angle in degrees.

  • sun_az – Sun azimuth angle in degrees.

  • ele_mat – Elevation matrix of the ASI image.

  • az_mat – Azimuth matrix of the ASI image.

Returns:

(row, col) coordinates of the sun in the image.

asi_core.image.circumsolar.compute_sun_dist_map(sun_ele, sun_az, ele_mat, az_mat, apply_filter=False, size=5)

Computes the distance map from each pixel to the sun in an ASI image.

Parameters:
  • sun_ele – Sun elevation angle in degrees.

  • sun_az – Sun azimuth angle in degrees.

  • ele_mat – Elevation matrix of the ASI image.

  • az_mat – Azimuth matrix of the ASI image.

  • apply_filter – Whether to apply median filtering (default: False).

  • size – Kernel size for median filtering (default: 5).

Returns:

Distance map (in degrees) to the sun.

asi_core.image.circumsolar.compute_cloud_coverage_and_distance_to_sun(seg_mask, cam_mask, sun_dist_map, cloud_value=1)

Computes cloud coverage and the minimum distance between clouds and the sun.

Parameters:
  • seg_mask – Segmentation mask of the sky (clouds vs. background).

  • cam_mask – Camera mask indicating valid pixels.

  • sun_dist_map – Distance map from each pixel to the sun.

  • cloud_value – Value representing clouds in the segmentation mask (default: 1).

Returns:

Tuple (cloud_coverage, min_dist_cloud, coord_cloud): - cloud_coverage: Fraction of the sky covered by clouds. - min_dist_cloud: Minimum distance between a cloud pixel and the sun. - coord_cloud: Coordinates of the closest cloud pixel to the sun.

asi_core.image.circumsolar.get_sun_dist(az, ele, timestamp, location)

Calculate the sun distance angle based on azimuth and elevation angles.

Parameters:
  • az – Azimuth angles (in degrees) of the sun.

  • ele – Elevation angles (in degrees) of the sun.

  • timestamp – Specific timestamp for which the solar position is calculated.

  • location – Dictionary containing the latitude, longitude, and altitude of the location.

Returns:

Three values: sun distance angle, sun azimuth angle, and sun elevation angle.

asi_core.image.circumsolar.get_saturated_mask(img, saturation_limit=240, gray_scale=True, channel_dim=-1)