Skip to content

capturegraph.procedures.toolkits.metadata.solar_notification #

Solar Notification Toolkit#

This module provides utilities for scheduling notifications based on optimal solar capture times. It combines the UserInputOptimalSolarTime procedure with the notification system to allow users to select and schedule alerts for optimal sun positions.

The toolkit provides a simple function that: 1. Displays an interactive solar plot with optimal capture times 2. Allows the user to select a time by tapping a bell marker 3. Schedules a notification for the selected time

This is ideal for time-lapse photography, astronomy, or any workflow that requires capturing data at specific solar angles.

schedule_optimal_solar_notification(session, target=None, count=5, minimum_altitude=-18.0) #

Schedules a notification at a user-selected optimal solar capture time.

Displays an interactive solar plot showing optimal times for data capture based on coverage analysis. The user selects a time by tapping one of the bell markers, and a notification is scheduled for that time.

Parameters:

Name Type Description Default
session str

Session name to compute optimal times for

required
target Procedure[PDirectory] | None

The target root directory containing session data. Defaults to GetRootDirectory() if not provided.

None
count int

Number of optimal time choices to display (default: 5)

5
minimum_altitude float

Minimum sun altitude in degrees to consider (default: -18.0, astronomical twilight)

-18.0

Returns:

Type Description
Procedure[PVoid]

A procedure that saves the selected time to the notification file

Example
# Add to your capture procedure
schedule_optimal_solar_notification(
    session="daily_capture",
    target=GetRootDirectory(),
    count=3,
    minimum_altitude=10.0  # Only consider when sun is 10° above horizon
)
Source code in capturegraph-lib/capturegraph/procedures/toolkits/metadata/solar_notification.py
def schedule_optimal_solar_notification(
    session: str,
    target: Procedure[PDirectory] | None = None,
    count: int = 5,
    minimum_altitude: float = -18.0,
) -> Procedure[PVoid]:
    """
    Schedules a notification at a user-selected optimal solar capture time.

    Displays an interactive solar plot showing optimal times for data capture
    based on coverage analysis. The user selects a time by tapping one of the
    bell markers, and a notification is scheduled for that time.

    Args:
        session: Session name to compute optimal times for
        target: The target root directory containing session data.
                Defaults to GetRootDirectory() if not provided.
        count: Number of optimal time choices to display (default: 5)
        minimum_altitude: Minimum sun altitude in degrees to consider
                         (default: -18.0, astronomical twilight)

    Returns:
        A procedure that saves the selected time to the notification file

    Example:
        ```python
        # Add to your capture procedure
        schedule_optimal_solar_notification(
            session="daily_capture",
            target=GetRootDirectory(),
            count=3,
            minimum_altitude=10.0  # Only consider when sun is 10° above horizon
        )
        ```
    """
    if target is None:
        target = GetRootDirectory()

    # Get optimal time selection from user
    selected_time = UserInputOptimalSolarTime(
        label="Select optimal capture time",
        target=target,
        session=session,
        count=count,
        minimum_altitude=minimum_altitude,
    )

    # Save to notification file
    return (
        target.get_notification_file()
        .save(procedure=selected_time, skip_if_exists=False)
        .set_label("Schedule Solar Notification")
    )