z3fdb.custom_store_builder ========================== .. py:module:: z3fdb.custom_store_builder Classes ------- .. autoapisummary:: z3fdb.custom_store_builder.VArray z3fdb.custom_store_builder.VGroup z3fdb.custom_store_builder.CustomStoreBuilder Module Contents --------------- .. py:class:: VArray .. py:attribute:: name :type: str .. py:attribute:: parent :type: VGroup .. py:attribute:: builder :type: pychunked_data_view.ChunkedDataViewBuilder .. py:class:: VGroup .. py:attribute:: parents :type: list[VGroup] | None .. py:attribute:: name :type: str .. py:attribute:: children :type: list[VGroup | VArray] .. py:method:: _join_path(group) :staticmethod: .. py:method:: __eq__(value: object, /) -> bool .. py:method:: get_prefix_path() -> list[str] .. py:method:: descent(name) -> VGroup .. py:class:: CustomStoreBuilder(fdb_config_file: pathlib.Path | None = None) Builds a zarr store backed by FDB. Use add_view() to register one or more MARS request views (each producing a virtual zarr array) at arbitrary nested paths, then call build() to obtain a read-only FdbZarrStore that zarr can open directly. .. py:attribute:: _config :value: None .. py:attribute:: structure :type: dict[str, VArray] .. py:attribute:: root .. py:method:: _merge_vgroup(vgroup: VGroup) Insert *vgroup* into the virtual group tree rooted at self.root. Navigates the parent chain stored on *vgroup*. At the first level where the expected child is not yet present (the divergence point) the group is appended and the traversal stops, so the whole subtree described by *vgroup* is inserted at the correct position. .. py:method:: _build_structure(path: list[str]) -> pychunked_data_view.ChunkedDataViewBuilder Return the ChunkedDataViewBuilder for *path*, creating it if needed. Also ensures the matching VGroup hierarchy is present in self.root and inserts a VArray leaf into its direct parent group. .. py:method:: add_view(path: list[str], mars_request_key_values: str, axes: list[pychunked_data_view.AxisDefinition], extractor_type: pychunked_data_view.ExtractorType) -> None Register a MARS request as a virtual zarr array at *path*. :param path: Location of the array in the zarr hierarchy, e.g. ``["group_a", "sub_group", "my_array"]``. :param mars_request_key_values: MARS request string, e.g. ``"type=an,class=ea,date=20200101,param=131"``. :param axes: Axis definitions describing how the request dimensions map to zarr array dimensions. :param extractor_type: How to extract data from the FDB response (e.g. GRIB). .. py:method:: extend_on_axis(path: list[str], axis: int) -> None Extend the view at *path* along the given *axis*. :param path: Location of the array in the zarr hierarchy (same as used in add_view). :param axis: Index of the axis to extend. .. py:method:: build() -> zarr.abc.store.Store Assemble all registered views into a read-only FdbZarrStore. Traverses the VGroup tree rooted at self.root. Each VGroup becomes an FdbZarrGroup and each VArray becomes an FdbZarrArray backed by its ChunkedDataViewBuilder.