eomatch.datatree.BuildMUDT.read_products

eomatch.datatree.BuildMUDT.read_products#

BuildMUDT.read_products(product_item_set: scrappi.product.ProductItemSet, roi: Polygon, download: bool = True, collection_read_args: dict | None = None) → list[source]#

Read each product in product_item_set, subsetting spatial (raster) products to roi.

Products are read via eoio.read. If a product has not yet been downloaded and download=True, it is fetched via scrappi before reading. Each returned dataset carries a "collection" attribute set to the product’s STAC collection ID, which is used by to_datatree() to name the DataTree node.

The roi/roi_crs subset is only passed for non-in-situ (raster) products. In-situ products (e.g. RadCalNet) are a single ground site’s point measurements, not an image – they have no spatial extent to subset, and eoio’s in-situ readers validate their subset dict strictly, raising ValueError for keys they don’t recognise (see eoio.readers.base.BaseReader._merge_and_validate). Passing a roi/roi_crs spatial subset to one previously failed every single in-situ read, not just an edge case.

The same strict validation applies to read_params: the resolved reader class (via eoio.readers.factory.ReaderFactory) is passed to _resolve_read_kwargs() so generic read_params (read.defaults) get filtered to keys that reader actually supports before being passed to eoio.read() – e.g. RadCalNet’s reader has no use_chunks/ save_extracted concept at all, so those generic defaults would otherwise fail every RadCalNet read the same way the unfiltered roi subset used to.

Parameters:
  • product_item_set – the set of products to read.

  • roi – WGS-84 polygon defining the spatial region of interest passed to eoio as a subset for non-in-situ products.

  • download – if True, download missing products before reading.

  • collection_read_args – per-collection call-time overrides (see _resolve_read_kwargs()).

Returns:

list of xarray.Dataset objects, one per product.