schema.processors.model_processor.DatedSpecResolver

Resolves date parameters in specs based on a model's time coordinates.

time_coordinates

Methods

collapse_to_date_interval_proto

View source

Collapses the given spec into a DateInterval proto.

If the spec's date range is unbounded, then the DateInterval proto will have the semantic "All", and we resolve it by consulting the time coordinates of the model bound to this resolver.

Note that the exclusive end date semantic will be preserved in the returned proto.

Returns
A DateInterval proto the represents the date interval specified by the spec.

resolve_to_bool_selected_times

View source

Resolves the given spec into a list of booleans indicating selected times.

Returns
A list of booleans indicating selected times, or None (semantic "All") if the bound spec is also None.

resolve_to_date_interval_open_end

View source

Resolves given spec into an open-ended [start, end) date interval.

resolve_to_date_interval_proto

View source

Resolves the given spec into a fully specified DateInterval proto.

If either start_date or end_date is None in the bound spec, then we resolve it by consulting the time coordinates of the model bound to this resolver. They are resolved to the first and last time coordinates (plus interval length), respectively.

Note that the exclusive end date semantic will be preserved in the returned proto.

Returns
A resolved DateInterval proto the represents the date interval specified by the bound spec.

resolve_to_enumerated_selected_times

View source

Resolves the given spec into an enumerated list of time coordinates.

Returns
An enumerated list of time coordinates, or None (semantic "All") if the bound spec is also None.

to_closed_date_interval_tuple

View source

Transforms given spec into a closed [start, end] date interval tuple.

For each of the bookends in the tuple, None value indicates a time coordinate default (first or last time coordinate, respectively).

Returns
A closed [start, end] date interval tuple.

transform_to_date_interval_protos

View source

Transforms the given spec into DateInterval protos.

If the spec's date range is unbounded, then the DateInterval proto will have the semantic "All", and we resolve it by consulting the time coordinates of the model bound to this resolver.

Note that the exclusive end date semantic will be preserved in the returned proto.

Returns
A list of DateInterval protos the represents the date intervals specified by the spec.