read

function of dascore.io.core source

read(
    path: str | pathlib._local.Path | upath.core.UPath | dascore.utils.io.IOResourceManager[str, Path, UPath, IOResourceManager] ,
    file_format: str | None[str, None] = None,
    file_version: str | None[str, None] = None,
    time: tuple[tuple[None | int | float | str | numpy.datetime64 | pandas.Timestamp | ellipsis[None, int, float, str, datetime64, Timestamp, <class ’ellipsis], None | int | float | str | numpy.datetime64 | pandas.Timestamp | ellipsis[None, int, float, str, datetime64, Timestamp, <class ’ellipsis]], None] = None,
    distance: tuple[tuple[float | ellipsis | None[float, <class ’ellipsis, None], float | ellipsis | None[float, <class ’ellipsis, None]], None] = None,
    **kwargs ,
)-> ‘dc.Spool’

Read a fiber file.

For most cases, dascore.spool is preferable to this function.

Parameters

Parameter Description
path A path to the file to read.
file_format A string indicating the file format. If not provided dascore will
try to estimate the format.
file_version An optional string indicating the format version.
time An optional tuple of time ranges.
distance An optional tuple of distances.
*kwargs All kwargs are passed to the format-specific read functions.
Note

Unlike spool this function reads the entire file into memory.

Examples

import numpy as np
import dascore as dc
from dascore.utils.downloader import fetch

file_path = fetch("terra15_das_1_trimmed.hdf5")

patch = dc.read(file_path)