asi_core.visualization.asi_keogram¶
This module provides functions to create keograms from all-sky images.
Functions¶
|
Get the indices of the full hours in a list of datetimes. |
|
Get a slice of the image based on the given slice position and strip size. |
|
Compose a keogram from a list of image files. |
|
Plot a keogram. |
|
Plots ceilometer data within a specified time range. |
|
Create and save a keogram image. |
Module Contents¶
- asi_core.visualization.asi_keogram.get_full_hour_indices(datetimes)¶
Get the indices of the full hours in a list of datetimes.
- Parameters:
datetimes (list) – A list of datetimes.
sampling_rate (str) – The sampling rate used to round the datetimes. Default is ’30s’.
- Returns:
An array containing the indices of the full hours in the list of datetimes.
- Return type:
numpy.ndarray
- asi_core.visualization.asi_keogram.get_image_slice(image, slice_pos, strip_size)¶
Get a slice of the image based on the given slice position and strip size.
- Parameters:
image (ndarray) – The image to slice.
slice_pos (int) – The position of the slice.
strip_size (int) – The size of the strip.
- Returns:
The sliced image.
- Return type:
ndarray
- asi_core.visualization.asi_keogram.compose_keogram(image_files, slice_pos, strip_size)¶
Compose a keogram from a list of image files.
- Parameters:
image_files (List[str]) – A list of paths to image files.
slice_pos (int) – The position of the slice to extract from each image.
strip_size (int) – The width of the image slice.
- Returns:
A tuple containing the concatenated image slices as a NumPy array and the timestamps as a Pandas DatetimeIndex.
- Return type:
tuple
- Raises:
Exception – If an error occurs while reading or processing an image file.
- asi_core.visualization.asi_keogram.plot_keogram(keogram, datetimes_slices, strip_size, camera_name='', title=None, ax=None)¶
Plot a keogram.
- Parameters:
keogram (ndarray) – The keogram data to be plotted.
datetimes_slices (ndarray) – The datetime slices corresponding to each column of the keogram.
strip_size (int) – The size of each strip in the keogram.
camera_name (str, default='') – The name of the camera. (optional)
title (str, default=None) – The title of the plot. (optional)
ax (AxesSubplot, default=None) – The matplotlib axes to plot on. (optional)
- Returns:
The matplotlib figure object. If ax is provided, returns None.
- Return type:
Figure
- asi_core.visualization.asi_keogram.plot_ceilometer_data(ceilometer_data_path, start_time, end_time, ax=None, tz_convert=None)¶
Plots ceilometer data within a specified time range.
- Parameters:
ceilometer_data_path (str) – The path to the ceilometer data file.
start_time (datetime) – The start time of the time range.
end_time (datetime) – The end time of the time range.
ax (matplotlib.axes.Axes, optional) – The axes to plot on. If not provided, a new figure and axes will be created.
tz_convert (str, optional) – The timezone to convert the data to.
- Returns:
The figure containing the plot.
- Return type:
matplotlib.figure.Figure
- asi_core.visualization.asi_keogram.create_and_save_keogram(image_path, path_save, tz='+0100', camera_name='resolve', strip_size=7, dpi_fig=1200, slice_pos=1056, increase_brightness=30, exposure_time=160, ceilometer_data_path=None)¶
Create and save a keogram image.
- Parameters:
image_path ([str, pathlib.Path]) – The path to the directory containing the images.
path_save ([str, pathlib.Path]) – The path to save the keogram image.
tz (str, optional) – The time zone to localize the timestamps. (default: “+0100”)
camera_name (str, optional) – The name of the camera. (default: “resolve”)
strip_size (int, optional) – The size of the strip in the keogram. (default: 7)
dpi_fig (int, optional) – The DPI (dots per inch) of the saved keogram image. (default: 1200)
slice_pos (int, optional) – The position of the slice in the keogram. (default: 1056)
increase_brightness (int, optional) – The amount to increase the brightness of the keogram image. (default: 30)
ceilometer_data_path (str, optional) – The path to the ceilometer data file. (default: None)
- Raises:
AssertionError – If the image_path is not a directory.
- Returns:
None