# Buggy code
def _get_indexers_coordinates(self, indexers):
    """Extract coordinates from indexers.
    Returns an OrderedDict mapping from coordinate name to the
    coordinate variable.

    Only coordinate with a name different from any of self.variables will
    be attached.
    """
    from .dataarray import DataArray

    coord_list = []
    for k, v in indexers.items():
        if isinstance(v, DataArray):
            v_coords = v.coords
            if v.dtype.kind == "b":
                if v.ndim != 1:  # we only support 1-d boolean array
                    raise ValueError(
                        "{:d}d-boolean array is used for indexing along "
                        "dimension {!r}, but only 1d boolean arrays are "
                        "supported.".format(v.ndim, k)
                    )
                # Make sure in case of boolean DataArray, its
                # coordinate also should be indexed.
                v_coords = v[v.values.nonzero()[0]].coords

            coord_list.append({d: v_coords[d].variable for d in v.coords})

    # we don't need to call align() explicitly, because merge_variables
    # already checks for exact alignment between dimension coordinates
    coords = merge_variables(coord_list)

    for k in self.dims:
        # make sure there are not conflict in dimension coordinates
        if (
            k in coords
            and k in self._variables
            and not coords[k].equals(self._variables[k])
        ):
            raise IndexError(
                "dimension coordinate {!r} conflicts between "
                "indexed and indexing objects:\n{}\nvs.\n{}".format(
                    k, self._variables[k], coords[k]
                )
            )

    attached_coords = OrderedDict()
    for k, v in coords.items():  # silently drop the conflicted variables.
        if k not in self._variables:
            attached_coords[k] = v
    return attached_coords


# Traceback (AxisError)
In [8]: xarr.variable[l_indices.variable, c_indices.variable] = 2
---------------------------------------------------------------------------
AxisError                                 Traceback (most recent call last)
<ipython-input-8-75558576dcaf> in <module>()
----> 1 xarr.variable[l_indices.variable, c_indices.variable] = 2

~/dev/xarray/xarray/core/variable.py in __setitem__(self, key, value)
653             value = np.moveaxis(value, new_order, range(len(new_order)))
654
--> 655         self._indexable_data[index_tuple] = value
656
657     @property

~/dev/xarray/xarray/core/indexing.py in __setitem__(self, key, value)
660     def __setitem__(self, key, value):
661         array, key = self._indexing_array_and_key(key)
--> 662         array[key] = value
663
664

~/dev/xarray/xarray/core/nputils.py in __setitem__(self, key, value)
132         mixed_positions, vindex_positions = _advanced_indexer_subspaces(key)
133         self._array[key] = np.moveaxis(value, vindex_positions,
--> 134                                        mixed_positions)

~/conda/envs/xarray-dev/lib/python3.5/site-packages/numpy/core/numeric.py in moveaxis(a, source, destination)
1599         transpose = a.transpose
1600
-> 1601     source = normalize_axis_tuple(source, a.ndim, 'source')
1602     destination = normalize_axis_tuple(destination, a.ndim, 'destination')
1603     if len(source) != len(destination):

~/conda/envs/xarray-dev/lib/python3.5/site-packages/numpy/core/numeric.py in normalize_axis_tuple(axis, ndim, argname, allow_duplicate)
1534     except TypeError:
1535         axis = tuple(axis)
-> 1536     axis = tuple(normalize_axis_index(ax, ndim, argname) for ax in axis)
1537     if not allow_duplicate and len(set(axis)) != len(axis):
1538         if argname:

~/conda/envs/xarray-dev/lib/python3.5/site-packages/numpy/core/numeric.py in <genexpr>(.0)
1534     except TypeError:
1535         axis = tuple(axis)
-> 1536     axis = tuple(normalize_axis_index(ax, ndim, argname) for ax in axis)
1537     if not allow_duplicate and len(set(axis)) != len(axis):
1538         if argname:

AxisError: source: axis 0 is out of bounds for array of dimension 0

# Fixed code
def _get_indexers_coordinates(self, indexers):
    """Extract coordinates from indexers.
    Returns an OrderedDict mapping from coordinate name to the
    coordinate variable.

    Only coordinate with a name different from any of self.variables will
    be attached.
    """
    from .dataarray import DataArray

    coord_list = []
    for k, v in indexers.items():
        if isinstance(v, DataArray):
            v_coords = v.coords
            if v.dtype.kind == "b":
                if v.ndim != 1:  # we only support 1-d boolean array
                    raise ValueError(
                        "{:d}d-boolean array is used for indexing along "
                        "dimension {!r}, but only 1d boolean arrays are "
                        "supported.".format(v.ndim, k)
                    )
                # Make sure in case of boolean DataArray, its
                # coordinate also should be indexed.
                v_coords = v[v.values.nonzero()[0]].coords

            coord_list.append({d: v_coords[d].variable for d in v.coords})

    # we don't need to call align() explicitly, because merge_variables
    # already checks for exact alignment between dimension coordinates
    coords = merge_variables(coord_list)
    assert_coordinate_consistent(self, coords)

    attached_coords = OrderedDict()
    for k, v in coords.items():  # silently drop the conflicted variables.
        if k not in self._variables:
            attached_coords[k] = v
    return attached_coords