sdf_xarray.resolve_paths

Contents

sdf_xarray.resolve_paths#

sdf_xarray.resolve_paths(file_pattern)[source]#

Resolve user input into sorted absolute paths to existing SDF files.

This helper is used by sdf_xarray.open_mfdataset() and sdf_xarray.open_mfdatatree() in order to decide which files to open.

Parameters:

file_pattern (str | PathLike | Iterable[str | PathLike]) –

Any of the following:

  • Directory path: load all *.sdf files in that directory.

  • Glob-like path: load all files matching the pattern (for example, normal_*.sdf).

  • List of exact paths: load only the provided files (for example, ["0000.sdf", "0010.sdf"]).

Returns:

Numerically sorted absolute paths to files that exist and have the .sdf extension.

Return type:

list[Path]

Raises:

FileNotFoundError – If no paths match, any resolved path is not a file, or any file does not have the .sdf extension.