|
52 | 52 |
|
53 | 53 | from parcels.fieldset import FieldSet |
54 | 54 |
|
55 | | - T_SanitizedFilenames = list[str] | dict[str, list[str]] |
| 55 | + T_Dimensions = Literal["lon", "lat", "depth", "data"] |
| 56 | + T_SanitizedFilenames = list[str] | dict[T_Dimensions, list[str]] |
56 | 57 |
|
57 | 58 | __all__ = ["Field", "NestedField", "VectorField"] |
58 | 59 |
|
@@ -580,10 +581,10 @@ def from_netcdf( |
580 | 581 | ) |
581 | 582 | lonlat_filename = lonlat_filename_lst[0] |
582 | 583 | if "depth" in dimensions: |
583 | | - depth_filename = _get_dim_filenames(filenames, "depth") |
584 | | - if isinstance(filenames, dict) and len(depth_filename) != 1: |
| 584 | + depth_filename_lst = _get_dim_filenames(filenames, "depth") |
| 585 | + if isinstance(filenames, dict) and len(depth_filename_lst) != 1: |
585 | 586 | raise NotImplementedError("Vertically adaptive meshes not implemented for from_netcdf()") |
586 | | - depth_filename = depth_filename[0] |
| 587 | + depth_filename = depth_filename_lst[0] |
587 | 588 |
|
588 | 589 | netcdf_engine = kwargs.pop("netcdf_engine", "netcdf4") |
589 | 590 | gridindexingtype = kwargs.get("gridindexingtype", "nemo") |
@@ -2553,7 +2554,7 @@ def __getitem__(self, key): |
2553 | 2554 | return val |
2554 | 2555 |
|
2555 | 2556 |
|
2556 | | -def _get_dim_filenames(filenames: T_SanitizedFilenames, dim: str) -> list[str]: |
| 2557 | +def _get_dim_filenames(filenames: T_SanitizedFilenames, dim: T_Dimensions) -> list[str]: |
2557 | 2558 | """Get's the relevant filenames for a given dimension.""" |
2558 | 2559 | if isinstance(filenames, list): |
2559 | 2560 | return filenames |
|
0 commit comments