read_multi

Contents

read_multi#

eoio.interface.read_multi(paths: str | List[str], vars_sel: Dict[str, List[str]] | None = None, subset: Dict[str, Any] | None = None, read_params: Dict[str, Any] | None = None, processors: Dict[str, Any] | List[Dict[str, Any]] | None = None, concat_dim: str = 'time', concat_coord: str | List[Any] | Callable[[str, Dataset], Any] | None = None, concat_processors: Dict[str, Any] | List[Dict[str, Any]] | None = None, on_mismatch: str = 'error', attrs: str = 'reconcile', coord_attrs: List[str] | None = None, *args, **kwargs) → Dataset[source]#

Read several EO product files as one call and concatenate them along a new (or existing) dimension.

Each path is read independently via read() (with identical vars_sel/subset/read_params/processors applied to every file), then the resulting datasets are concatenated along concat_dim.

Typical uses are an in-situ time series (e.g. one Hypernets file per measurement cycle, each already carrying its own time dimension) or a multi-date raster stack (e.g. several Sentinel-2 scenes stacked along a new time dimension).

Parameters:
  • paths – Explicit list of product paths, a directory (all files inside it recognised by a registered reader), or a glob pattern. All entries are expected to resolve to the same reader type.

  • vars_sel – See read(). Applied identically to every file.

  • subset – See read(). Applied identically to every file.

  • read_params – See read(). Applied identically to every file.

  • processors – Post-processing steps run per file, before concatenation. See read().

  • concat_dim –

    Name of the dimension to concatenate along. Default "time".

    If concat_dim is already a dimension on every per-file dataset (e.g. in-situ readers that carry their own time dimension), the datasets are concatenated directly. Otherwise a new dimension is created per file via expand_dims, using the coordinate value resolved from concat_coord (e.g. a multi-date raster stack).

  • concat_coord –

    How to compute the coordinate value for each file along concat_dim when a new dimension needs to be created:

    • str – dot-path into ds.attrs, e.g. "product_metadata.sensing_time".

    • list – explicit values, one per path, same order as the resolved paths.

    • callable(path, ds) -> value – escape hatch, e.g. to parse a timestamp out of the filename.

    • None (default) – if concat_dim already exists on every dataset, used as-is; otherwise falls back to file order as an integer index coordinate, with a warning.

  • concat_processors – Post-processing steps run once on the final concatenated dataset.

  • on_mismatch –

    How to handle datasets whose variable set or per-file shape (other than concat_dim) doesn’t match — this also covers raster grid mismatches (a mismatched x/y shape is just another schema mismatch):

    • "error" (default) – raise, naming the offending files.

    • "skip" – drop mismatched files, with a warning.

    • "union" – outer-join concat; missing values become NaN.

  • attrs –

    How to combine dataset-level and per-variable attrs across files:

    • "reconcile" (default) – attrs identical across every file are kept; attrs that differ are kept as a per-file list attr (or promoted to a coordinate, see coord_attrs) rather than being silently dropped.

    • "first" – cheap legacy behaviour: just keep the first file’s attrs, discarding the rest (xarray’s own xr.concat default).

  • coord_attrs – Dataset-level attribute names to promote to a coordinate on concat_dim instead of being kept as a list attr — e.g. coord_attrs=["product_name"] gives you a per-file product_name coordinate alongside time. Only used when attrs="reconcile".

Returns:

The concatenated xarray.Dataset.