Skip to content

Navigation and subsetting

Query the timeframe hierarchy and subset calendars.

calendar_timeframes

calendar_timeframes(
    x: Calendar, finest: bool = False
) -> list[str] | str

Timeframes, coarsest first (or only the finest).

calendar_rank

calendar_rank(x: Calendar, timeframe: str | Sequence[str])

calendar_timeslices

calendar_timeslices(
    x: Calendar,
    timeframe: str | None = None,
    qualified: bool = False,
) -> list[str]

Leaf timeslice IDs, or the labels at one timeframe. qualified=True gives the node IDs at that timeframe (the leaves of the pruned calendar).

calendar_leaftable

calendar_leaftable(x: Calendar) -> pa.Table

calendar_family

calendar_family(
    x: Calendar,
    parent: str | None = None,
    child: str | None = None,
) -> pa.Table

Adjacent-timeframe parent/child pairs, in leaftable order.

calendar_ancestry

calendar_ancestry(x: Calendar) -> pa.Table

Every (coarser, finer) label pair sharing a timeslice, all pairs.

calendar_children

calendar_children(
    x: Calendar,
    timeframe: str,
    label: object,
    target: str | None = None,
) -> list[str]

Labels one timeframe finer (or at target) within label.

calendar_parents

calendar_parents(
    x: Calendar,
    timeframe: str,
    label: object,
    target: str | None = None,
) -> list[str]

Labels one timeframe coarser (or at target) containing label.

calendar_descendants

calendar_descendants(
    x: Calendar,
    timeframe: str,
    label: object,
    target: str | None = None,
) -> pa.Table

calendar_ancestors

calendar_ancestors(
    x: Calendar,
    timeframe: str,
    label: object,
    target: str | None = None,
) -> pa.Table

calendar_share

calendar_share(
    x: Calendar, timeframe: str, within: str | None = None
) -> pa.Table

Each label's share of the year, or of its within parent.

filter_calendar

filter_calendar(
    x: Calendar, timeframe: str, labels: object
) -> Calendar

Keep the timeslices whose timeframe label is in labels.

Shares are NOT renormalised: year_fraction becomes the kept share and the result is a sample of its root parent (coverage, parent_totals, parent_name, name "parent[TF:labels]").

calendar_coverage

calendar_coverage(x: Calendar, weight: str | None = None)

Fraction of the root parent's share/weight this calendar keeps.

calendar_summary

calendar_summary(x: Calendar) -> CalendarSummary

Per-weight coverage, ranges, and the catalog classification.