code: def observed_data_to_xarray(self):
          
          posterior_model = self.posterior_model
          if self.dims is None:
              dims = {}
          else:
              dims = self.dims
          observed_names = self.observed_data
          if isinstance(observed_names, str):
              observed_names = [observed_names]
          observed_data = OrderedDict()
          for key in observed_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
              )
              observed_data[key] = xr.DataArray(vals, dims=val_dims, coords=coords)
          return xr.Dataset(data_vars=observed_data, attrs=make_attrs(library=self.stan))
docs: Convert observed data to xarray.