class_docstr: Test the GeoTIFF Writer class.
class_docstr_tok: ["Test","the","GeoTIFF","Writer","class","."]
docstr: Test writing an image with a colormap.
docstr_tok: ["Test","writing","an","image","with","a","colormap","."]
code: def test_colormap_write(self, tmp_path):
      """Test writing an image with a colormap."""
      from trollimage.colormap import spectral
      from trollimage.xrimage import XRImage
  
      from satpy.writers.geotiff import GeoTIFFWriter
  
      datasets = _get_test_datasets_2d()
      w = GeoTIFFWriter(base_dir=tmp_path)
      # we'd have to customize enhancements to test this through
      # save_datasets. We'll use `save_image` as a workaround.
      img = XRImage(datasets[0])
      img.palettize(spectral)
      w.save_image(img, keep_palette=True)
  
imports: from datetime import datetime
  from unittest import mock
  import dask.array
  import numpy
  import pytest
  import xarray
label_desc: Use image node_id 4 for calling the TestGeoTIFFWriter obj's underlying member method code with example usage: obj.test_colormap_write(tmp_path) without return types