File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88from functools import lru_cache
99from importlib .resources import files
1010from pathlib import Path
11- from typing import TYPE_CHECKING , TextIO
11+ from typing import TYPE_CHECKING , Literal , TextIO
1212
1313import copernicusmarine
1414import numpy as np
1515import xarray as xr
16- from parcels import FieldSet
1716
17+ from parcels import FieldSet
1818from virtualship .errors import CopernicusCatalogueError
1919
2020if TYPE_CHECKING :
@@ -187,7 +187,7 @@ def mfp_to_yaml(coordinates_file_path: str, yaml_output_path: str): # noqa: D41
187187
188188
189189def _validate_numeric_to_timedelta (
190- value : int | float | timedelta , unit : str
190+ value : int | float | timedelta , unit : Literal [ "minutes" , "days" ]
191191) -> timedelta :
192192 """Convert to timedelta when reading."""
193193 if isinstance (value , timedelta ):
@@ -196,6 +196,10 @@ def _validate_numeric_to_timedelta(
196196 return timedelta (minutes = float (value ))
197197 elif unit == "days" :
198198 return timedelta (days = float (value ))
199+ else :
200+ raise ValueError (
201+ f"Unsupported time unit: { unit } . Supported units are: 'minutes', 'days'."
202+ )
199203
200204
201205def _get_expedition (expedition_dir : Path ) -> Expedition :
You can’t perform that action at this time.
0 commit comments