<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def observed_data_to_xarray(self):
 """Convert observed_data to xarray."""

        data = self.observed_data
        if not isinstance(data, dict):
            raise TypeError("DictConverter.observed_data is not a dictionary")
        if self.dims is None:
            dims = {}
        else:
            dims = self.dims
        observed_data = dict()
        for key, vals in data.items():
            vals = np.atleast_1d(vals)
            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=None))