class_docstr: Writer to produce MITIFF image files.
docstr: Put all together and save as a tiff file.
  
  Include the special tags making it a mitiff file.
docstr_tok: ["Put","all","together","and","save","as","a","tiff","file",".","Include","the","special","tags","making","it","a","mitiff","file","."]
code: def _save_datasets_as_mitiff(
      self, datasets, image_description, gen_filename, **kwargs
  ):
      """Put all together and save as a tiff file.
  
      Include the special tags making it a mitiff file.
  
      """
      tmp_gen_filename = self._generate_intermediate_filename(
          gen_filename
      )
      tiffinfo = {}
      tiffinfo[IMAGEDESCRIPTION] = (image_description).encode("latin-1")
  
      cns = self.translate_channel_name.get(kwargs["sensor"], {})
      if isinstance(datasets, list):
          LOG.debug("Saving datasets as list")
          mitiff_frames = []
          for _cn in self.channel_order[kwargs["sensor"]]:
              for dataset in datasets:
                  if dataset.attrs["name"] == _cn:
                      # Need to possible translate channels names from satpy to mitiff
                      cn = cns.get(
                          dataset.attrs["name"], dataset.attrs["name"]
                      )
                      data = self._calibrate_data(
                          dataset,
                          dataset.attrs["calibration"],
                          self.mitiff_config[kwargs["sensor"]][cn][
                              "min-val"
                          ],
                          self.mitiff_config[kwargs["sensor"]][cn][
                              "max-val"
                          ],
                      )
                      mitiff_frames.append(
                          Image.fromarray(
                              data.astype(np.uint8), mode="L"
                          )
                      )
                      break
          mitiff_frames[0].save(
              tmp_gen_filename,
              save_all=True,
              append_images=mitiff_frames[1:],
              compression="raw",
              compress_level=9,
              tiffinfo=tiffinfo,
          )
      elif "dataset" in datasets.attrs["name"]:
          LOG.debug("Saving dataset as single dataset.")
          self._save_single_dataset(
              datasets, cns, tmp_gen_filename, tiffinfo, kwargs
          )
      elif self.palette:
          LOG.debug("Saving dataset as palette.")
          self._save_as_palette(
              datasets, tmp_gen_filename, tiffinfo, **kwargs
          )
      else:
          LOG.debug("Saving datasets as enhanced image")
          self._save_as_enhanced(datasets, tmp_gen_filename, **kwargs)
      os.rename(tmp_gen_filename, gen_filename)
  
imports: import logging
  import os
  import dask
  import numpy
  from PIL import Image, ImagePalette
  from satpy.dataset import DataID, DataQuery
  from satpy.writers import ImageWriter, get_enhanced_image
label_desc: Use image node_id 26 for calling the MITIFFWriter obj's underlying member method code with example usage: obj._save_datasets_as_mitiff(datasets, image_description, gen_filename) without return types