Skip to content

Solar Events Module

The solar events module provides types and data for solar events (solstices and equinoxes) used in calendar calculations.

solar_events

Classes

SolarEvent dataclass

SolarEvent(type, time)

Represents a single solar event (a solstice or an equinox).

Attributes:

Name Type Description
type SolarEventType

The type of solar event.

time datetime

The datetime of the solar event.

Functions
localize
localize(timezone)

Return this solar event converted to a given timezone.

Parameters:

Name Type Description Default
timezone

A tzinfo or ZoneInfo to convert the event time into.

required

Returns:

Name Type Description
SolarEvent

A new SolarEvent instance with time localized to the

provided timezone.

Source code in src/solcadre/solar_events.py
def localize(self, timezone):
    """Return this solar event converted to a given timezone.

    Args:
        timezone: A tzinfo or ZoneInfo to convert the event time into.

    Returns:
        SolarEvent: A new SolarEvent instance with time localized to the
        provided timezone.
    """
    return SolarEvent(self.type, self.time.astimezone(timezone))

SolarEventType

Bases: Enum

Enumeration of the four solar event types (solstices and equinoxes).