class_docstr: Encapsulate Dictionary specific logic.
class_docstr_tok: ["Encapsulate","Dictionary","specific","logic","."]
docstr: Convert posterior samples to xarray.
docstr_tok: ["Convert","posterior","samples","to","xarray","."]
code: def posterior_to_xarray(self):
      """Convert posterior samples to xarray."""
      data = self._init_dict("posterior")
      data_warmup = self._init_dict(f"{WARMUP_TAG}posterior")
      if not isinstance(data, dict):
          raise TypeError("DictConverter.posterior is not a dictionary")
      if not isinstance(data_warmup, dict):
          raise TypeError(
              "DictConverter.warmup_posterior is not a dictionary"
          )
  
      if "log_likelihood" in data:
          warnings.warn(
              "log_likelihood variable found in posterior group."
              " For stats functions log likelihood data needs to be in log_likelihood group.",
              UserWarning,
          )
      posterior_attrs = self._kwargs.get("posterior_attrs")
      posterior_warmup_attrs = self._kwargs.get(
          "posterior_warmup_attrs"
      )
      return (
          dict_to_dataset(
              data,
              library=None,
              coords=self.coords,
              dims=self.dims,
              attrs=posterior_attrs,
              index_origin=self.index_origin,
          ),
          dict_to_dataset(
              data_warmup,
              library=None,
              coords=self.coords,
              dims=self.dims,
              attrs=posterior_warmup_attrs,
              index_origin=self.index_origin,
          ),
      )
  
imports: import warnings
  from typing import Optional
  from ..rcparams import rcParams
  from .base import dict_to_dataset, requires
  from .inference_data import WARMUP_TAG, InferenceData
label_desc: Use image node_id 3 for calling the DictConverter obj's underlying member method code with example usage: obj.posterior_to_xarray() and returns: dict_to_dataset,  dict_to_dataset