# Buggy code
def __call__(self, projectables, nonprojectables=None, **info):
    if len(projectables) != 3:
        raise ValueError("Expected 3 datasets, got %d" % (len(projectables),))

    try:
        the_data = np.rollaxis(
            np.ma.dstack([projectable for projectable in projectables]), axis=2
        )
    except ValueError:
        raise IncompatibleAreas
    else:
        areas = [projectable.info.get("area", None) for projectable in projectables]
        areas = [area for area in areas if area is not None]
        if areas and areas.count(areas[0]) != len(areas):
            raise IncompatibleAreas

    info = combine_info(*projectables)
    info.update(self.info)
    # FIXME: should this be done here ?
    info["wavelength"] = None
    info.pop("units", None)
    sensor = set()
    for projectable in projectables:
        current_sensor = projectable.info.get("sensor", None)
        if current_sensor:
            if isinstance(current_sensor, (str, bytes, six.text_type)):
                sensor.add(current_sensor)
            else:
                sensor |= current_sensor
    if len(sensor) == 0:
        sensor = None
    elif len(sensor) == 1:
        sensor = list(sensor)[0]
    info["sensor"] = sensor
    info["mode"] = "RGB"
    return Dataset(data=the_data, **info)


# Traceback (AttributeError)
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-24-58ece08c15f3> in <module>()
----> 1 lcl.save_datasets(writer='cf', filename='/tmp/foo.nc')

/home/lahtinep/Software/pytroll/packages/satpy/satpy/scene.pyc in save_datasets(self, writer, datasets, **kwargs)
632             datasets = self.datasets.values()
633         writer = self.get_writer(writer, **kwargs)
--> 634         writer.save_datasets(datasets, **kwargs)
635
636     def get_writer(self, writer="geotiff", **kwargs):

/home/lahtinep/Software/pytroll/packages/satpy/satpy/writers/cf_writer.pyc in save_datasets(self, datasets, filename, **kwargs)
176                     coords = [line_coord, pixel_coord]
177
--> 178                 domain = cf.Domain(dim=coords,
179                                    aux=aux,
180                                    ref=grid_mapping)

AttributeError: 'module' object has no attribute 'Domain'

# Fixed code
def __call__(self, projectables, nonprojectables=None, **info):
    if len(projectables) != 3:
        raise ValueError("Expected 3 datasets, got %d" % (len(projectables),))

    areas = [projectable.attrs.get("area", None) for projectable in projectables]
    areas = [area for area in areas if area is not None]
    if areas and areas.count(areas[0]) != len(areas):
        raise IncompatibleAreas
    try:
        times = [proj["time"][0].values for proj in projectables]
    except KeyError:
        pass
    else:
        # Is there a more gracious way to handle this ?
        if np.max(times) - np.min(times) > np.timedelta64(1, "s"):
            raise IncompatibleTimes
        else:
            mid_time = (np.max(times) - np.min(times)) / 2 + np.min(times)
        projectables[0]["time"] = [mid_time]
        projectables[1]["time"] = [mid_time]
        projectables[2]["time"] = [mid_time]
    try:
        the_data = xr.concat(projectables, "bands")
        the_data["bands"] = ["R", "G", "B"]
    except ValueError:
        raise IncompatibleAreas

    attrs = combine_attrs(*projectables)
    attrs.update({key: val for (key, val) in info.items() if val is not None})
    attrs.update(self.attrs)
    # FIXME: should this be done here ?
    attrs["wavelength"] = None
    attrs.pop("units", None)
    sensor = set()
    for projectable in projectables:
        current_sensor = projectable.attrs.get("sensor", None)
        if current_sensor:
            if isinstance(current_sensor, (str, bytes, six.text_type)):
                sensor.add(current_sensor)
            else:
                sensor |= current_sensor
    if len(sensor) == 0:
        sensor = None
    elif len(sensor) == 1:
        sensor = list(sensor)[0]
    attrs["sensor"] = sensor
    attrs["mode"] = "RGB"
    the_data.attrs.update(attrs)
    the_data.attrs.pop("resolution", None)
    the_data.attrs.pop("calibration", None)
    the_data.attrs.pop("modifiers", None)
    the_data.name = the_data.attrs["name"]

    return the_data