class_docstr: Encapsulate PyStan3 specific logic.
class_docstr_tok: ["Encapsulate","PyStan3","specific","logic","."]
docstr: Convert observed data to xarray.
code: def predictions_constant_data_to_xarray(self):
      """Convert observed data to xarray."""
      posterior_model = self.posterior_model
      dims = {} if self.dims is None else self.dims
      names = self.predictions_constant_data
      names = [names] if isinstance(names, str) else names
      data = OrderedDict()
      for key in names:
          vals = np.atleast_1d(posterior_model.data[key])
          val_dims = dims.get(key)
          val_dims, coords = generate_dims_coords(
              vals.shape, key, dims=val_dims, coords=self.coords
          )
          data[key] = xr.DataArray(vals, dims=val_dims, coords=coords)
      return xr.Dataset(
          data_vars=data, attrs=make_attrs(library=self.stan)
      )
  
imports: import re
  from collections import OrderedDict
  from copy import deepcopy
  from math import ceil
  import numpy
  import xarray
  from ..None import _log
  from ..rcparams import rcParams
  from .base import dict_to_dataset, generate_dims_coords, infer_stan_dtypes, make_attrs, requires
  from .inference_data import InferenceData
label_desc: Use image node_id 11 for calling the PyStan3Converter obj's underlying member method code with example usage: obj.predictions_constant_data_to_xarray() and returns: xr