class_docstr: Container for inference data storage using xarray.
  
  For a detailed introduction to ``InferenceData`` objects and their usage, see
  :ref:`xarray_for_arviz`. This page provides help and documentation
  on ``InferenceData`` methods and their low level implementation.
class_docstr_tok: ["Container","for","inference","data","storage","using","xarray",".","For","a","detailed","introduction","to","``","InferenceData","``","objects","and","their","usage",",","see",":","ref",":","`","xarray_for_arviz","`",".","This","page","provides","help","and","documentation","on","``","InferenceData","``","methods","and","their","low","level","implementation","."]
docstr: Convert InferenceData to a :class:`zarr.hierarchy.Group`.
  
  The zarr storage is using the same group names as the InferenceData.
  
  Raises
  ------
  TypeError
      If no valid store is found.
  
  Parameters
  ----------
  store: zarr.storage i.e MutableMapping or str, optional
      Zarr storage class or path to desired DirectoryStore.
  
  Returns
  -------
  zarr.hierarchy.group
      A zarr hierarchy group containing the InferenceData.
  
  References
  ----------
  https://zarr.readthedocs.io/
docstr_tok: ["Convert","InferenceData","to","a",":","class",":","`","zarr.hierarchy.Group","`",".","The","zarr","storage","is","using","the","same","group","names","as","the","InferenceData",".","Raises","--","--","--","TypeError","If","no","valid","store","is","found",".","Parameters","--","--","--","--","--","store",":","zarr.storage","i.e","MutableMapping","or","str",",","optional","Zarr","storage","class","or","path","to","desired","DirectoryStore",".","Returns","--","--","--","-","zarr.hierarchy.group","A","zarr","hierarchy","group","containing","the","InferenceData",".","References","--","--","--","--","--","https",":","\/\/zarr.readthedocs.io\/"]
code: def to_zarr(self, store=None):
      """Convert InferenceData to a :class:`zarr.hierarchy.Group`.
  
      The zarr storage is using the same group names as the InferenceData.
  
      Raises
      ------
      TypeError
          If no valid store is found.
  
      Parameters
      ----------
      store: zarr.storage i.e MutableMapping or str, optional
          Zarr storage class or path to desired DirectoryStore.
  
      Returns
      -------
      zarr.hierarchy.group
          A zarr hierarchy group containing the InferenceData.
  
      References
      ----------
      https://zarr.readthedocs.io/
      """
      try:  # Check zarr
          import zarr
  
          assert version.parse(zarr.__version__) >= version.parse(
              "2.5.0"
          )
      except (ImportError, AssertionError) as err:
          raise ImportError(
              "'to_zarr' method needs Zarr (2.5.0+) installed."
          ) from err
  
      # Check store type and create store if necessary
      if store is None:
          store = zarr.storage.TempStore(suffix="arviz")
      elif isinstance(store, str):
          store = zarr.storage.DirectoryStore(path=store)
      elif not isinstance(store, MutableMapping):
          raise TypeError(f"No valid store found: {store}")
  
      groups = self.groups()
  
      if not groups:
          raise TypeError("No valid groups found!")
  
      # order matters here, saving attrs after the groups will erase the groups.
      if self.attrs:
          xr.Dataset(attrs=self.attrs).to_zarr(store=store, mode="w")
  
      for group in groups:
          # Create zarr group in store with same group name
          getattr(self, group).to_zarr(
              store=store, group=group, mode="w"
          )
  
      return zarr.open(store)
  
imports: import os
  import re
  import sys
  import uuid
  import warnings
  from collections import OrderedDict, defaultdict
  from collections.abc import MutableMapping, Sequence
  from copy import copy
  from copy import deepcopy
  from datetime import datetime
  from html import escape
  from typing import TYPE_CHECKING, Any, Iterable, Iterator, List, Mapping, Optional, Tuple, TypeVar, Union, overload
  import numpy
  import xarray
  from packaging import version
  from ..rcparams import rcParams
  from ..utils import HtmlTemplate, _subset_list, _var_names, either_dict_or_kwargs
  from .base import _extend_xr_method, _make_json_serializable, dict_to_dataset
label_desc: Use image node_id 23 for calling the InferenceData obj's underlying member method code with example usage: obj.to_zarr(store) and returns: zarr