gordias.util.cmip_path.get_stem_time_range#

gordias.util.cmip_path.get_stem_time_range(path: Path | str) TimeRange#

Get the time range from a filename.

Tries to extract a time range from the filename. If there is no time range, but only a single time, this function will still return a range, with the filename time as start and end.

Parameters:

path (pathlib.Path | str) – Filename to extract time range from.

Returns:

Extracted time range.

Return type:

time_string.TimeRange

Raises:

ValueError – If a time range could not be extracted.