Skip to content

conventions

Naming conventions for the EFTS netCDF file format.

ConvertibleToTimestamp module-attribute

ConvertibleToTimestamp = Union[
    str, datetime, datetime64, Timestamp
]

Definition of a 'type' for type hints.

check_index_found

check_index_found(
    index_id: Optional[int],
    identifier: str,
    dimension_id: str,
) -> None

Helper function to check that a value (index) was is indeed found in the dimension.

Source code in src/efts_io/conventions.py
113
114
115
116
117
118
119
120
121
122
123
def check_index_found(
    index_id: Optional[int],
    identifier: str,
    dimension_id: str,
) -> None:
    """Helper function to check that a value (index) was is indeed found in the dimension."""
    # return isinstance(index_id, np.int64)
    if index_id is None:
        raise ValueError(
            f"identifier '{identifier}' not found in the dimension '{dimension_id}'",
        )

get_default_dim_order

get_default_dim_order() -> List[str]

Default order of dimensions in the netCDF file.

Returns:

  • List[str]

    List[str]: dimension names: [lead_time, stations, ensemble_member, time]

Source code in src/efts_io/conventions.py
 99
100
101
102
103
104
105
106
107
108
109
110
def get_default_dim_order() -> List[str]:
    """Default order of dimensions in the netCDF file.

    Returns:
        List[str]: dimension names: [lead_time, stations, ensemble_member, time]
    """
    return [
        LEAD_TIME_DIMNAME,
        STATION_DIMNAME,
        ENS_MEMBER_DIMNAME,
        TIME_DIMNAME,
    ]