import dascore as dc
from dascore.utils.downloader import fetch
= fetch("prodml_2.1.h5")
file_path
= dc.get_format(file_path) file_format, file_version
get_format
get_format(
path: str | pathlib.Path | dascore.utils.io.IOResourceManager[str, Path, IOResourceManager] ,
file_format: str | None[str, None] = None,
file_version: str | None[str, None] = None,
formatter_hint: dascore.io.core.FiberIO | None[FiberIO, None] = None,
**kwargs ,
)-> ‘tuple[str, str]’
Return the name of the format contained in the file and version number.
Parameters
Parameter | Description |
---|---|
path | The path to the file. |
file_format | The known file format. |
file_version | The known file version. |
formatter_hint |
A suspected formatter to try first. This is primarily an optimization for reading file archives where the formats usually are the same. |
Returns
A tuple of (file_format_name, version) both as strings.
Raises
dascore.exceptions.UnknownFiberFormat - Could not determine the fiber format.