eomatch.datatree.BuildMUDT.to_datatree#
- BuildMUDT.to_datatree(product_ds: Iterable[Dataset | DataTree], opt_attrs: dict | None = None, crop_to_shared_valid_extent: bool = True) DataTree[source]#
Assemble an
xarray.DataTreefrom a list of per-sensor datasets.Each dataset becomes a child node named by its
"collection"attribute (e.g."LANDSAT_C2L1"). If the same collection appears more than once a numeric suffix is appended ("LANDSAT_C2L1_2", etc.).- Parameters:
product_ds – iterable of per-sensor datasets, each carrying a
"collection"attribute identifying the STAC collection.opt_attrs – additional attributes to merge into the DataTree root (e.g.
{"matchup:id": matchup.stac_id}, asrun()passes).crop_to_shared_valid_extent – if
True, crop gridded products to their shared valid-data lat/lon extent before assembling the tree (seecrop_to_shared_valid_extent()). On by default.
- Returns:
DataTree with one child node per sensor and, as root attributes,
date_created(plus anyopt_attrs) and provenance:title,summary,source(each product’s path) andhistory(this assembly step).- Raises:
ValueError – if
product_dsisNone, or – only whencrop_to_shared_valid_extentisTrue– if two or more products’ valid-data extents don’t overlap (seecrop_to_shared_valid_extent()). Both cases raise the same exception type.