class_docstr: Encapsulate CmdStanPy specific logic.
docstr: Convert prior samples to xarray.
code: def prior_to_xarray(self):
      """Convert prior samples to xarray."""
      if not (
          hasattr(self.prior, "metadata")
          or hasattr(self.prior, "stan_vars_cols")
      ):  # pre_v_0_9_68
          columns = self.prior.column_names
          prior_predictive = _as_set(self.prior_predictive)
          prior_predictive = _filter_columns(columns, prior_predictive)
  
          invalid_cols = set(
              prior_predictive
              + [col for col in columns if col.endswith("__")]
          )
          valid_cols = [
              col for col in columns if col not in invalid_cols
          ]
  
          data, data_warmup = _unpack_frame(
              self.prior,
              columns,
              valid_cols,
              self.save_warmup,
              self.dtypes,
          )
      elif (
          hasattr(self.prior, "metadata")
          and hasattr(self.prior.metadata, "sample_vars_cols")
      ) or hasattr(
          self.prior, "stan_vars_cols"
      ):  # pre_v_1_0_0
          if hasattr(self.prior, "metadata"):
              items = list(self.prior.metadata.stan_vars_cols.keys())
          else:
              items = list(self.prior.stan_vars_cols.keys())
          if self.prior_predictive is not None:
              try:
                  items = _filter(items, self.prior_predictive)
              except ValueError:
                  pass
          data, data_warmup = _unpack_fit_pre_v_1_0_0(
              self.prior,
              items,
              self.save_warmup,
              self.dtypes,
          )
      elif hasattr(self.prior, "metadata") and hasattr(
          self.prior.metadata, "stan_vars_cols"
      ):  # pre_v_1_2_0
          items = list(self.prior.metadata.stan_vars_cols.keys())
          if self.prior_predictive is not None:
              try:
                  items = _filter(items, self.prior_predictive)
              except ValueError:
                  pass
          data, data_warmup = _unpack_fit_pre_v_1_2_0(
              self.prior,
              items,
              self.save_warmup,
              self.dtypes,
          )
      else:
          items = list(self.prior.metadata.stan_vars.keys())
          if self.prior_predictive is not None:
              try:
                  items = _filter(items, self.prior_predictive)
              except ValueError:
                  pass
          data, data_warmup = _unpack_fit(
              self.prior,
              items,
              self.save_warmup,
              self.dtypes,
          )
  
      return (
          dict_to_dataset(
              data,
              library=self.cmdstanpy,
              coords=self.coords,
              dims=self.dims,
              index_origin=self.index_origin,
          ),
          dict_to_dataset(
              data_warmup,
              library=self.cmdstanpy,
              coords=self.coords,
              dims=self.dims,
              index_origin=self.index_origin,
          ),
      )
  
imports: import logging
  import re
  from collections import defaultdict
  from copy import deepcopy
  from pathlib import Path
  import numpy
  from ..rcparams import rcParams
  from .base import dict_to_dataset, infer_stan_dtypes, make_attrs, requires
  from .inference_data import InferenceData
label_desc: Use image node_id 11 for calling the CmdStanPyConverter obj's underlying member method code with example usage: obj.prior_to_xarray() and returns: dict_to_dataset,  dict_to_dataset