|
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 |
|
@@ -600,10 +601,10 @@ def from_netcdf( |
600 | 601 | ) |
601 | 602 | lonlat_filename = lonlat_filename_lst[0] |
602 | 603 | if "depth" in dimensions: |
603 | | - depth_filename = _get_dim_filenames(filenames, "depth") |
604 | | - if isinstance(filenames, dict) and len(depth_filename) != 1: |
| 604 | + depth_filename_lst = _get_dim_filenames(filenames, "depth") |
| 605 | + if isinstance(filenames, dict) and len(depth_filename_lst) != 1: |
605 | 606 | raise NotImplementedError("Vertically adaptive meshes not implemented for from_netcdf()") |
606 | | - depth_filename = depth_filename[0] |
| 607 | + depth_filename = depth_filename_lst[0] |
607 | 608 |
|
608 | 609 | netcdf_engine = kwargs.pop("netcdf_engine", "netcdf4") |
609 | 610 | gridindexingtype = kwargs.get("gridindexingtype", "nemo") |
@@ -2578,7 +2579,7 @@ def __getitem__(self, key): |
2578 | 2579 | return val |
2579 | 2580 |
|
2580 | 2581 |
|
2581 | | -def _get_dim_filenames(filenames: T_SanitizedFilenames, dim: str) -> list[str]: |
| 2582 | +def _get_dim_filenames(filenames: T_SanitizedFilenames, dim: T_Dimensions) -> list[str]: |
2582 | 2583 | """Get's the relevant filenames for a given dimension.""" |
2583 | 2584 | if isinstance(filenames, list): |
2584 | 2585 | return filenames |
|
0 commit comments