Convert a dictionary into an xarray.DataArray

        Input dict can take several forms::

            d = {'dims': ('t'), 'data': x}

            d = {'coords': {'t': {'dims': 't', 'data': t,
                                  'attrs': {'units':'s'}}},
                 'attrs': {'title': 'air temperature'},
                 'dims': 't',
                 'data': x,
                 'name': 'a'}

        where 't' is the name of the dimesion, 'a' is the name of the array,
        and  x and t are lists, numpy.arrays, or pandas objects.

        Parameters
        ----------
        d : dict, with a minimum structure of {'dims': [..], 'data': [..]}

        Returns
        -------
        obj : xarray.DataArray

        See also
        --------
        DataArray.to_dict
        Dataset.from_dict

def from_dict(cls, d):
        """
        Convert a dictionary into an xarray.DataArray

        Input dict can take several forms::

            d = {'dims': ('t'), 'data': x}

            d = {'coords': {'t': {'dims': 't', 'data': t,
                                  'attrs': {'units':'s'}}},
                 'attrs': {'title': 'air temperature'},
                 'dims': 't',
                 'data': x,
                 'name': 'a'}

        where 't' is the name of the dimesion, 'a' is the name of the array,
        and  x and t are lists, numpy.arrays, or pandas objects.

        Parameters
        ----------
        d : dict, with a minimum structure of {'dims': [..], 'data': [..]}

        Returns
        -------
        obj : xarray.DataArray

        See also
        --------
        DataArray.to_dict
        Dataset.from_dict
        """
        coords = None
        if 'coords' in d:
            try:
                coords = OrderedDict([(k, (v['dims'],
                                           v['data'],
                                           v.get('attrs')))
                                      for k, v in d['coords'].items()])
            except KeyError as e:
                raise ValueError(
                    "cannot convert dict when coords are missing the key "
                    "'{dims_data}'".format(dims_data=str(e.args[0])))
        try:
            data = d['data']
        except KeyError:
            raise ValueError("cannot convert dict without the key 'data''")
        else:
            obj = cls(data, coords, d.get('dims'), d.get('name'),
                      d.get('attrs'))
        return obj