smart_geocubes.core.toi
¶
Time of Interest (TOI) utilities.
Functions:
-
extract_toi_range–Extract the datetime range or a specific datetime from the time of interest (toi).
-
normalize_toi–Normalize the time of interest (toi) to the given temporal extent.
extract_toi_range
¶
extract_toi_range(
toi: TOI,
) -> (
str
| datetime
| tuple[str, str]
| tuple[datetime | datetime]
| None
)
Extract the datetime range or a specific datetime from the time of interest (toi).
Parameters:
-
(toi¶TOI) –The time of interest.
Returns:
-
str | datetime | tuple[str, str] | tuple[datetime | datetime] | None–str | datetime | tuple[str, str] | tuple[datetime, datetime] | None: The extracted datetime or datetime range.
Raises:
-
ValueError–If the time of interest is of an invalid type.
Source code in src/smart_geocubes/core/toi.py
normalize_toi
¶
Normalize the time of interest (toi) to the given temporal extent.
Parameters:
-
(extent¶DatetimeIndex) –The temporal extent to normalize against.
-
(toi¶TOI) –The time of interest to normalize.
-
(method¶str, default:'nearest') –The method to use for normalization. Defaults to "nearest". Other options are "pad", "backfill", "ffill", "bfill".
Returns:
-
DatetimeIndex–pd.DatetimeIndex: The normalized time of interest.
Raises:
-
ValueError–If the time of interest is not found in the temporal extent.