Source code for xgc_analysis.catalog.campaign_source_reader

"""Campaign source-reader backend built on the shared FileReader reader."""

from __future__ import annotations

from xgc_analysis.adios_file_reader import AdiosFileSourceReader


[docs] class CampaignSourceReader(AdiosFileSourceReader): """ Read selected variables and steps from an HPC-Campaign ``.aca`` file. Campaign files expose product variables as qualified ADIOS names such as ``xgc.f2d.00010.bp/e_den``. Product readers use unqualified names such as ``e_den``. The read-plan executor passes ``source_id`` from the selected source fragment, and this reader combines it with each requested variable to form the campaign-qualified ADIOS name. """ def __init__(self, file_reader=None, *, owns_reader: bool = False): """ Configure the campaign source reader. Parameters ---------- file_reader : adios2.FileReader or None, optional Optional persistent campaign FileReader handle. Remote campaign reads are more robust when this is left as ``None`` so each read batch opens a fresh ACA FileReader; callers may still pass a handle for local archives or controlled experiments. owns_reader : bool, optional Whether :meth:`close` should close the supplied reader. """ super().__init__( file_reader=file_reader, qualify_with_source_id=True, owns_reader=owns_reader, )