preheat_open.time

time.py

This module defines classes and functions for handling date and time ranges, time resolutions, and time-related utilities.

Classes:

SubDateRange TimeResolution DateRange

Functions:

timestep_start

Examples:
>>> from datetime import datetime
>>> from preheat_open.time import TimeResolution, SubDateRange, DateRange, timestep_start
>>> tr = TimeResolution.HOUR
>>> print(tr.pandas_alias)
H
>>> sdr = SubDateRange(datetime(2023, 1, 1), datetime(2023, 1, 2))
>>> print(sdr)
[2023-01-01 00:00:00, 2023-01-02 00:00:00]
>>> dr = DateRange([sdr], resolution=TimeResolution.DAY)
>>> print(dr)
DateRange(2023-01-01--2023-01-02, continuous, resolution=TimeResolution.DAY)

Functions

timestep_start(step, t)

Computes the start of the current timestep.

Classes

DateRange([ranges, resolution, start, end])

Represents a collection of SubDateRange objects.

SubDateRange([start, end])

Represents a range of dates with a start and an end.

TimeResolution(value)

Enum representing different time resolutions.