# Buggy code
def __init__(self, filename, filename_info, filetype_info, prologue, epilogue):
    """Initialize the reader."""
    super(HRITMSGFileHandler, self).__init__(
        filename,
        filename_info,
        filetype_info,
        (msg_hdr_map, msg_variable_length_headers, msg_text_headers),
    )
    self.prologue = prologue.prologue
    self.epilogue = epilogue.epilogue

    earth_model = self.prologue["GeometricProcessing"]["EarthModel"]
    b = (earth_model["NorthPolarRadius"] + earth_model["SouthPolarRadius"]) / 2.0 * 1000
    self.mda["projection_parameters"]["a"] = earth_model["EquatorialRadius"] * 1000
    self.mda["projection_parameters"]["b"] = b
    ssp = self.prologue["ImageDescription"]["ProjectionDescription"]["LongitudeOfSSP"]
    self.mda["projection_parameters"]["SSP_longitude"] = ssp
    self.mda["projection_parameters"]["SSP_latitude"] = 0.0
    self.platform_id = self.prologue["SatelliteStatus"]["SatelliteDefinition"][
        "SatelliteID"
    ]
    self.platform_name = "Meteosat-" + SATNUM[self.platform_id]
    self.mda["platform_name"] = self.platform_name
    service = filename_info["service"]
    if service == "":
        self.mda["service"] = "0DEG"
    else:
        self.mda["service"] = service
    self.channel_name = CHANNEL_NAMES[self.mda["spectral_channel_id"]]


# 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 __init__(self, filename, filename_info, filetype_info, prologue, epilogue):
    """Initialize the reader."""
    super(HRITMSGFileHandler, self).__init__(
        filename,
        filename_info,
        filetype_info,
        (msg_hdr_map, msg_variable_length_headers, msg_text_headers),
    )
    self.prologue = prologue.prologue
    self.epilogue = epilogue.epilogue

    earth_model = self.prologue["GeometricProcessing"]["EarthModel"]
    self.mda["offset_corrected"] = earth_model["TypeOfEarthModel"] == 1
    b = (earth_model["NorthPolarRadius"] + earth_model["SouthPolarRadius"]) / 2.0 * 1000
    self.mda["projection_parameters"]["a"] = earth_model["EquatorialRadius"] * 1000
    self.mda["projection_parameters"]["b"] = b
    ssp = self.prologue["ImageDescription"]["ProjectionDescription"]["LongitudeOfSSP"]
    self.mda["projection_parameters"]["SSP_longitude"] = ssp
    self.mda["projection_parameters"]["SSP_latitude"] = 0.0
    self.platform_id = self.prologue["SatelliteStatus"]["SatelliteDefinition"][
        "SatelliteID"
    ]
    self.platform_name = "Meteosat-" + SATNUM[self.platform_id]
    self.mda["platform_name"] = self.platform_name
    service = filename_info["service"]
    if service == "":
        self.mda["service"] = "0DEG"
    else:
        self.mda["service"] = service
    self.channel_name = CHANNEL_NAMES[self.mda["spectral_channel_id"]]