Skip to content

href

Parse Met Office deterministic forecast hrefs into structured objects.

Href dataclass

Href(
    href: str,
    model: Model,
    theme: Theme,
    parameter: str,
    reference_datetime: str,
    valid_datetime: str,
    forecast_horizon: str,
)

collection_id property

collection_id: str

Gets the STAC collection ID for this href.

Returns:

Type Description
str

The collection ID string.

datetime property

datetime: datetime

Gets the datetime from the valid time string.

Returns:

Type Description
datetime

A datetime object parsed from the valid time.

duration property

duration: str | None

Extracts the duration from the parameter if present.

Returns:

Type Description
str | None

The duration string (ISO 8601 format) if the parameter includes one,

str | None

None otherwise.

item_id property

item_id: str

Gets the STAC item ID for this href.

variable property

variable: str | None

The CF-standard name for this parameter.

__str__

__str__() -> str

Returns the href as a string.

Returns:

Type Description
str

The href string.

Source code in src/stactools/met_office_deterministic/href.py
def __str__(self) -> str:
    """Returns the href as a string.

    Returns:
        The href string.
    """
    return self.href